Relationships
#830 data query --select crashes on BigInt: "Do not know how to serialize a BigInt" when CEL size() reaches the JSON renderer
Opened by atalanta · 6/26/2026· Shipped 6/26/2026
A swamp data query --select whose CEL projection returns an integer from size() crashes during JSON serialization, even though the CEL expression itself is valid and evaluates.
Steps to reproduce
Given any model with at least one data artifact whose attributes contain an array, run a select that calls size():
swamp data query 'modelName == "my-model"' --select '{"n": attributes.values.size()}' --jsonResult:
{
"error": "Do not know how to serialize a BigInt",
"stack": " at JSON.stringify (<anonymous>)\n at renderJson (.../src/presentation/renderers/data_query.ts:210:22)\n at completed (.../src/presentation/renderers/data_query.ts:272:11)\n ..."
}Reproduces identically whether size() is:
- bare:
--select 'attributes.values.size()' - nested in an object:
--select '{"n": attributes.values.size()}' - on a sub-element:
--select '{"len": attributes.values[0].size()}'
A select with no integer-returning CEL op (e.g. --select '{"name": name}') works fine.
Root cause
CEL size() returns a 64-bit integer surfaced to JS as a BigInt. The data_query JSON renderer (src/presentation/renderers/data_query.ts:210) calls JSON.stringify on the result, and JSON.stringify throws on BigInt with no replacer. So a valid query dies purely in output serialization.
Suggested fix
In the data_query renderer, pass a JSON.stringify replacer that coerces BigInt to Number (or string), or normalize CEL integer results to JS numbers before serialization.
Environment
- swamp 20260626.005336.0-sha.f302d18e (reproduced on the immediately prior build too)
- macOS (darwin arm64)
Shipped
Click a lifecycle step above to view its details.