{"record":{"id":"2f8eb44f4170fd35","repo":"JuliusBrussee/caveman","slug":"cachebench-trace-line-d-invalid-schema-or-reque","errorCode":null,"errorMessage":"cachebench: trace line %d: invalid schema or request_id","messagePattern":"cachebench: trace line (.+?): invalid schema or request_id","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cacheengine/cachebench/trace.go","lineNumber":313,"sourceCode":"\t\t}\n\t\tif len(records) >= limits.MaxRecords {\n\t\t\treturn nil, fmt.Errorf(\"cachebench: trace exceeds record limit %d\", limits.MaxRecords)\n\t\t}\n\t\tif !validUniqueJSONObject(raw) {\n\t\t\treturn nil, fmt.Errorf(\"cachebench: trace line %d: duplicate or invalid JSON\", line)\n\t\t}\n\t\tdecoder := json.NewDecoder(bytes.NewReader(raw))\n\t\tdecoder.DisallowUnknownFields()\n\t\tvar record TraceRecord\n\t\tif err := decoder.Decode(&record); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"cachebench: trace line %d: %w\", line, err)\n\t\t}\n\t\tvar trailing any\n\t\tif err := decoder.Decode(&trailing); err != io.EOF {\n\t\t\treturn nil, fmt.Errorf(\"cachebench: trace line %d: trailing JSON\", line)\n\t\t}\n\t\tif record.Schema != TraceSchema && record.Schema != TraceSchemaV2 && record.Schema != TraceSchemaV1 || !validBoundedText(record.RequestID, 512, false) || seen[record.RequestID] {\n\t\t\treturn nil, fmt.Errorf(\"cachebench: trace line %d: invalid schema or request_id\", line)\n\t\t}\n\t\tif _, err := time.Parse(time.RFC3339Nano, record.At); err != nil || !validTraceIdentity(record) || record.PrefixTokens < 0 {\n\t\t\treturn nil, fmt.Errorf(\"cachebench: trace line %d: incomplete request identity\", line)\n\t\t}\n\t\tif len(record.Body) > limits.MaxBodyBytes || !json.Valid(record.Body) || record.BodySHA256 == \"\" || record.BodySHA256 != bodyDigest(record.Body) {\n\t\t\treturn nil, fmt.Errorf(\"cachebench: trace line %d: invalid body or digest\", line)\n\t\t}\n\t\tif record.StableSegmentCount < 0 || record.StableSegmentCount > len(record.Prefix) || !validPrefix(record.Prefix) {\n\t\t\treturn nil, fmt.Errorf(\"cachebench: trace line %d: invalid prefix\", line)\n\t\t}\n\t\tif record.Schema == TraceSchema || record.Schema == TraceSchemaV2 {\n\t\t\tif record.ExpectedRPM <= 0 || record.ExpectedCalls <= 0 || !validTimingBasis(record.TimingBasis) {\n\t\t\t\treturn nil, fmt.Errorf(\"cachebench: trace line %d: incomplete replay metadata\", line)\n\t\t\t}\n\t\t}\n\t\tif record.Schema == TraceSchema {\n\t\t\tif record.DeclaredInputTokens <= 0 || record.DeclaredInputTokens < record.PrefixTokens || record.MaxOutputTokens <= 0 || !requestBudgetMatchesBody(record) {\n\t\t\t\treturn nil, fmt.Errorf(\"cachebench: trace line %d: incomplete or mismatched billed-token budget\", line)","sourceCodeStart":295,"sourceCodeEnd":331,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/766dce6b1394ebb56a3090748d5a0240a5aefb36/cacheengine/cachebench/trace.go#L295-L331","documentation":"The decoded trace record's Schema is not a known version (V1/V2/current) or its RequestID fails the bounded-text check or was already seen. This is the first per-record semantic gate after successful decode.","triggerScenarios":"Thrown at cacheengine/cachebench/trace.go:313 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Regenerate the trace with a supported schema stamp","Ensure unique, non-empty request ids per line"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"766dce6b1394ebb56a3090748d5a0240a5aefb36","analyzedAt":"2026-08-18T03:14:35.516Z","contentChangedAt":"2026-08-18T03:14:35.516Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}