Seems to be the same underlying issue as here: by default, Table
compiles its argument when the number of values is 250 or more. Evidently Internal`Bag
doesn't like this!
If all Internal`Bag
s are the same, then
ConstantArray[Internal`Bag[0], 250]
seems to work.
Otherwise, temporarily changing the TableCompileLength
system option works:
tcl = SystemOptions["CompileOptions" -> "TableCompileLength"];
SetSystemOptions[
"CompileOptions" -> {"TableCompileLength" -> \[Infinity]}];
Table[Internal`Bag[0], {i, 250}]
SetSystemOptions[tcl];
Perhaps, a general heuristic: if anything starts breaking or slowing down at 250, suspect behind-the-scenes Compilation. See here, here, here, and here for more examples.