Skip to content

Raise CBOR MaxNestedLevels to 1000 in vespa CLI#36624

Open
andreer wants to merge 1 commit intomasterfrom
andreer/cbor-max-nested-levels
Open

Raise CBOR MaxNestedLevels to 1000 in vespa CLI#36624
andreer wants to merge 1 commit intomasterfrom
andreer/cbor-max-nested-levels

Conversation

@andreer
Copy link
Copy Markdown
Member

@andreer andreer commented May 1, 2026

Summary

  • The vespa CLI prefers CBOR for query responses (`Accept: application/cbor, application/json;q=0.9` in `client/go/internal/cli/cmd/query.go`).
  • The CBOR decoder in `client/go/internal/ioutil/ioutil.go` was constructed without setting `MaxNestedLevels`, so it used the fxamacker/cbor default of 32. Responses with deeper nesting (e.g. deep grouping results, large traces) failed to decode with `cbor: exceeded max nested level 32`, surfacing to the user as `failed to decode CBOR response`.
  • Set `MaxNestedLevels: 1000`, which should comfortably cover any real Vespa response while staying well under the library's max of 65535.

Test plan

  • `go build ./...` in `client/go`
  • `go test ./internal/ioutil/... ./internal/cli/cmd/...`
  • New `TestCBORToJSONDeepNesting` builds a 100-level nested map and verifies it decodes (would fail under the previous default of 32)

The fxamacker/cbor decoder defaults to a max nesting depth of 32, which
is below what some Vespa query responses can produce (e.g. deep grouping
results or traces). Without this, the CLI fails with "cbor: exceeded
max nested level 32" since CBOR is the default response format.
@andreer andreer requested a review from BrageHK May 1, 2026 07:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant