{"record":{"id":"88b9f12d91c98bba","repo":"JuliusBrussee/caveman","slug":"not-valid-toon-88b9f1","errorCode":null,"errorMessage":"not valid TOON","messagePattern":"not valid TOON","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"engine/toon.go","lineNumber":24,"sourceCode":"\n\t\"github.com/JuliusBrussee/caveman/engine/compressors\"\n)\n\n// EncodeTOON converts JSON to the lossless TOON subset without CCR or size\n// gating. It is for explicit agent/CLI requests, not automatic proxy routing.\nfunc (e *Engine) EncodeTOON(input []byte) ([]byte, error) {\n\tout, ok := compressors.NewTOON().Compress(input)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"not losslessly TOON-encodable (invalid JSON, or nested/non-uniform shape); keep JSON\")\n\t}\n\treturn out, nil\n}\n\n// DecodeTOON converts TOON back to compact JSON. Malformed TOON fails closed.\nfunc (e *Engine) DecodeTOON(input []byte) ([]byte, error) {\n\tv, ok := compressors.DecodeTOON(input)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"not valid TOON\")\n\t}\n\tout, err := json.Marshal(v)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn out, nil\n}\n","sourceCodeStart":6,"sourceCodeEnd":32,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/27d5a3981a347890211bb1bf2439e5c821a63bc9/engine/toon.go#L6-L32","documentation":"Error \"not valid TOON\" thrown in JuliusBrussee/caveman.","triggerScenarios":"Thrown at engine/toon.go:24 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Provide valid TOON input."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"27d5a3981a347890211bb1bf2439e5c821a63bc9","analyzedAt":"2026-08-15T09:26:11.751Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}