Skip to content

Update go-jsonnet to v0.22.0: v0.21.0 panics on super[<expr>] and crash-loops the server #270

Description

@periklis

Summary

v0.17.0 and current main pin github.com/google/go-jsonnet v0.21.0, which panics during static analysis on any file containing super[e] where e is not a plain variable reference. DidOpen/DidChange call jsonnet.SnippetToAST directly, so the panic kills the process. The client restarts the server, re-opens the same document, and it panics again — an unrecoverable crash loop that disables Jsonnet support for the whole workspace while such a file exists in it.

Reproducer

local f = { key: 'a' };
{ a: 1 } + { a: super[f.key] }

Opening this with vscode-jsonnet 0.7.4 kills the server on didOpen:

panic: Unexpected node <nil>
...
github.com/google/go-jsonnet/internal/program.analyzeVisit(...)
	go-jsonnet@v0.21.0/internal/program/static_analyzer.go:155
...
github.com/grafana/jsonnet-language-server/pkg/server.(*Server).DidOpen(...)
	pkg/server/server.go:117

Root cause

In go-jsonnet v0.21.0 the desugarer's *ast.SuperIndex case never recurses into node.Index, so a computed index survives desugaring as a raw ast.Index with Id set and Index == nil. The static analyzer then reaches case *ast.Index -> visitNext(a.Index, ...) (static_analyzer.go:106) with that nil and falls through to default: panic(...) on line 155.

Fix

Fixed upstream in google/go-jsonnet#849 (commit google/go-jsonnet@fb23cdf), closing google/go-jsonnet#679, released in go-jsonnet v0.22.0 on 2026-03-24.

The bump is clean

Verified on tag v0.17.0 with go mod edit -require=github.com/google/go-jsonnet@v0.22.0 && go mod tidy:

  • Compiles with no source changes; go test ./... fully passes.
  • go.mod side effects are only the go directive moving to 1.24.5 (go-jsonnet v0.22.0 requires Go 1.24, which this repo already targets) and three transitive golang.org/x/* bumps.
  • Verified end to end by driving both builds over stdio with initialize + didOpen of a file containing super[e]: the v0.21.0 build exits 2 with the panic above, the v0.22.0 build stays alive.

Prior attempt

Renovate already opened #258 for this bump and it was autoclosed. The only failure reported there was a transient go mod tidy TLS timeout fetching the Go toolchain, not an incompatibility. That thread also has a user asking for v0.22.0 for the new numeric-underscore literals (1_500_000), which v0.21.0 rejects.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions