Reformatted to make the structure a bit more visible on usenet:
> set header [dict create
length [dict create received 2956
calculated 9436
header 1]
^^^^^^
222222
rgba {0.5960783958435059 0.6666666865348816 0.686274528503418 0.0}
vertices 1080
strips 768]
> dict with header {
^^^^^^
111111
> dict with length {
> puts $calculated
> }
> }
> ... raises the error:
> 9436
> missing value to go with key
> % set errorInfo
> missing value to go with key
> while executing
> "dict with header {
> dict with length {
> puts $calculated
> }
> }"
> % set errorCode
> TCL VALUE DICTIONARY
> The tcl version is:
> % info patchlevel
> 8.6.4
> Should I file a bug?
No, you should fix your code.
Note that your outermost variable holding the nested dict is named
"header" (item labeled with "111111" above).
Note, also, that inside the nested dict, you also define a key named
"header" (item labeled with "222222" above).
Note the first sentence of the manpage documenation of "dict with":
dict with dictionaryVariable ?key ...? body
Execute the Tcl script in body with the value for each key in
dictionaryVariable mapped (in a manner similarly to dict update)
to a variable with the same name.
Each key in the dict becomes a new variable in the enclosing scope [1]
of the execution of the "dict with".
Now, what do you think happens when your original variable "header"
(originally containing a dict) is overwritten by a new variable
"header" (containing a scalar "1") due to the "dict with" operation on
the nested dict?
Making either of the following changes will fix your bug:
1) change "set header" to "set header2" and "dict with header" to
"dict with header2" (so that the nested dict with does not
overwrite "header" with a scalar).
2) change the key "header" inside the nested dict to header2 (or some
other, non conflicting, name) (again, so that the nested dict with
does not overwrite the outer "header" variable.
[1] Note that "enclosing scope" is that of the proc where this code
resides, or the global namespace if it runs outside of a proc. I.e.,
dict with does not change variables just inside its own code block, it
changes them for the entire proc.