{"record":{"id":"1d93dfc06c68a6c0","repo":"JuliusBrussee/caveman","slug":"unsupported-token-t","errorCode":null,"errorMessage":"unsupported token %T","messagePattern":"unsupported token %T","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"engine/compressors/toon_encode.go","lineNumber":190,"sourceCode":"\t\t\t\treturn toonValue{}, err\n\t\t\t}\n\t\t\tif d, ok := end.(json.Delim); !ok || d != ']' {\n\t\t\t\treturn toonValue{}, fmt.Errorf(\"array not closed\")\n\t\t\t}\n\t\t\treturn toonValue{kind: toonArray, arr: arr}, nil\n\t\tdefault:\n\t\t\treturn toonValue{}, fmt.Errorf(\"unexpected delimiter %q\", t)\n\t\t}\n\tcase nil:\n\t\treturn toonValue{kind: toonNull}, nil\n\tcase bool:\n\t\treturn toonValue{kind: toonBool, b: t}, nil\n\tcase json.Number:\n\t\treturn toonValue{kind: toonNumber, s: t.String()}, nil\n\tcase string:\n\t\treturn toonValue{kind: toonString, s: t}, nil\n\tdefault:\n\t\treturn toonValue{}, fmt.Errorf(\"unsupported token %T\", tok)\n\t}\n}\n\nfunc writeTOONValue(b *strings.Builder, v toonValue, name string, indent int, opt EncodeOptions) bool {\n\tswitch v.kind {\n\tcase toonObject:\n\t\tif name == \"\" {\n\t\t\tif len(v.obj) == 0 {\n\t\t\t\tb.WriteString(\"{}\\n\")\n\t\t\t\treturn true\n\t\t\t}\n\t\t\treturn writeTOONObject(b, v.obj, indent, opt)\n\t\t}\n\t\tif !safeTOONKey(name) {\n\t\t\treturn false\n\t\t}\n\t\tif len(v.obj) == 0 {\n\t\t\twriteIndent(b, indent)","sourceCodeStart":172,"sourceCodeEnd":208,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/3ee70a102609e550bd2e68004bf5990a9341c851/engine/compressors/toon_encode.go#L172-L208","documentation":"readJSONTOONValue switches on the token type from json.Decoder.Token() and handles json.Delim, nil, bool, json.Number, and string. Any other token type falls into the default branch and is rejected with this error, since the TOON value model has no representation for it.","triggerScenarios":"Only reachable if the decoder returns a token type outside the handled set — in practice this is a defensive guard; it can surface if the input feeds something the standard decoder maps to an unhandled token type in a future Go version or via a custom decoder.","commonSituations":"Rare; typically seen only after Go stdlib changes or when the parse function is refactored to feed tokens from a non-standard source.","solutions":["Confirm the input is plain JSON parsed with encoding/json's json.Decoder.","Check your Go toolchain version and pin to a known-good version if a stdlib upgrade introduced this.","If you extended the token handling, add a case for the new token type in the switch."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"v, err := parseJSONTOON(input)\nif err != nil {\n    if strings.Contains(err.Error(), \"unsupported token\") {\n        return fmt.Errorf(\"toon encoder cannot handle this token type; report with Go version %s\", runtime.Version())\n    }\n    return err\n}","preventionTips":["Parse input only with the standard encoding/json decoder.","Pin the Go toolchain version in CI; re-run encoder tests after stdlib upgrades.","Treat this error as a bug report trigger — it indicates an unhandled token type in the parser."],"tags":["json","parser","toon","encoding"],"backgroundTag":"json-parse-error","analyzedSha":"3ee70a102609e550bd2e68004bf5990a9341c851","analyzedAt":"2026-09-20T15:53:39.229Z","contentChangedAt":"2026-09-20T15:53:39.229Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}