Skip to main content
← Back to list
01Issue
BugShippedSwamp CLI
Assigneesstack72

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()}' --json

Result:

{
  "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)
02Bog Flow
OPENTRIAGEDIN PROGRESSSHIPPED+ 1 MOREASSIGNED+ 2 MOREREVIEW+ 3 MOREPR_MERGED+ 1 MORECONTRIBUTOR_NOTIFIED

Shipped

6/26/2026, 9:58:31 AM

Click a lifecycle step above to view its details.

03Sludge Pulse
stack72 assigned stack726/26/2026, 9:29:29 AM
Editable. Press Enter to edit.

stack72 commented 6/26/2026, 9:58:42 AM

Thanks @atalanta for reporting this! The fix has been merged and a release is on its way. We appreciate your contribution to swamp.

Sign in to post a ripple.