{"record":{"id":"b1473ec8eb16e85b","repo":"kubernetes/kops","slug":"unknown-delim-v","errorCode":null,"errorMessage":"unknown delim: %v","messagePattern":"unknown delim: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/jsonutils/streamwriter.go","lineNumber":89,"sourceCode":"\t\t\tj.indent += \"  \"\n\t\t\tj.state += \"{\"\n\t\tcase json.Delim('['):\n\t\t\tj.indent += \"  \"\n\t\t\tj.state += \"[\"\n\t\tcase json.Delim(']'), json.Delim('}'):\n\t\t\tj.indent = j.indent[:len(j.indent)-2]\n\t\t\tindent = j.indent\n\t\t\tj.state = j.state[:len(j.state)-1]\n\t\t\tif j.state != \"\" && j.state[len(j.state)-1] == 'F' {\n\t\t\t\tj.state = j.state[:len(j.state)-1]\n\t\t\t\tj.path = j.path[:len(j.path)-1]\n\t\t\t}\n\t\t\t// Don't put a comma on the last field in a block\n\t\t\tif j.deferred == \",\\n\" {\n\t\t\t\tj.deferred = \"\\n\"\n\t\t\t}\n\t\tdefault:\n\t\t\treturn fmt.Errorf(\"unknown delim: %v\", tt)\n\t\t}\n\n\t\tswitch state {\n\t\tcase 0:\n\t\t\tif err := j.writeRaw(indent + v); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\tcase '{':\n\t\t\tif err := j.writeRaw(indent + v); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\tcase '[':\n\t\t\tif err := j.writeRaw(indent + v); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\tcase 'F':\n\t\t\tif err := j.writeRaw(v); err != nil {\n\t\t\t\treturn err","sourceCodeStart":71,"sourceCodeEnd":107,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/pkg/jsonutils/streamwriter.go#L71-L107","documentation":"JSONStreamWriter.WriteToken received a json.Delim token that is not one of { [ ] }. The writer maintains pretty-printing state per delimiter, so any other delim byte cannot be serialized. This normally indicates corrupted or manually fabricated tokens being fed to the writer rather than tokens from a real json.Decoder.","triggerScenarios":"Calling WriteToken with a json.Delim value constructed manually (e.g. json.Delim(':') or json.Delim(',')), or re-tokenizing text that was not valid JSON so the decoder yields unexpected delim bytes.","commonSituations":"Custom JSON rewriting tools that synthesize tokens instead of iterating a json.Decoder over valid JSON; feeding fragments of JSON (e.g. a key/value pair including its colon) through the stream writer.","solutions":["Only pass tokens obtained from a json.Decoder iterating valid JSON text into WriteToken.","Check that the delimiter is one of { [ ] } before calling WriteToken, or skip punctuation tokens.","If you need to write raw syntax characters, use writeRaw-style output or a plain writer, not WriteToken."],"exampleFix":"// before\nw.WriteToken(json.Delim(':'))\n// after\nif d, ok := tok.(json.Delim); ok && (d == '{' || d == '[' || d == ']' || d == '}') {\n\tw.WriteToken(tok)\n} else {\n\t// skip non-structural delimiter tokens\n}","handlingStrategy":"validation","validationCode":"func isStructuralDelim(t json.Token) bool {\n\td, ok := t.(json.Delim)\n\treturn ok && (d == '{' || d == '[' || d == ']' || d == '}')\n}\n// call: if isStructuralDelim(tok) { w.WriteToken(tok) }","typeGuard":"func isStructuralDelim(t json.Token) bool {\n\td, ok := t.(json.Delim)\n\treturn ok && (d == '{' || d == '[' || d == ']' || d == '}')\n}","tryCatchPattern":null,"preventionTips":["Feed only tokens from json.Decoder.Token() into WriteToken.","Never construct json.Delim values by hand.","Unit-test streaming helpers against full valid JSON documents."],"tags":["json","streaming","invalid-token"],"backgroundTag":"json-invalid-token","analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T12:17:11.808Z"}