{"record":{"id":"a55be2a65d5b906b","repo":"JuliusBrussee/caveman","slug":"cachebench-malformed-hugging-face-rows-array","errorCode":null,"errorMessage":"cachebench: malformed Hugging Face rows array","messagePattern":"cachebench: malformed Hugging Face rows array","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cacheengine/cachebench/corpus.go","lineNumber":284,"sourceCode":"\t\t\t\treturn nil, fmt.Errorf(\"cachebench: decode Hugging Face row: %w\", err)\n\t\t\t}\n\t\t\tif len(raw) > limits.MaxRowBytes {\n\t\t\t\treturn nil, fmt.Errorf(\"cachebench: Hugging Face row exceeds %d bytes\", limits.MaxRowBytes)\n\t\t\t}\n\t\t\tvar wire hfRowWire\n\t\t\tif err := decodeOneJSON(raw, &wire); err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"cachebench: decode Hugging Face row: %w\", err)\n\t\t\t}\n\t\t\trow, err := validateCorpusWire(wire.Row, wire.RowIndex, limits)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"cachebench: Hugging Face row %d: %w\", wire.RowIndex, err)\n\t\t\t}\n\t\t\tif err := appendCorpusRow(&rows, sessions, &retainedBytes, row, limits); err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"cachebench: Hugging Face row %d: %w\", wire.RowIndex, err)\n\t\t\t}\n\t\t}\n\t\tif end, err := decoder.Token(); err != nil || end != json.Delim(']') {\n\t\t\treturn nil, errors.New(\"cachebench: malformed Hugging Face rows array\")\n\t\t}\n\t}\n\tif end, err := decoder.Token(); err != nil || end != json.Delim('}') {\n\t\treturn nil, errors.New(\"cachebench: malformed Hugging Face rows object\")\n\t}\n\tvar trailing any\n\tif err := decoder.Decode(&trailing); err != io.EOF {\n\t\treturn nil, errors.New(\"cachebench: trailing JSON after Hugging Face rows object\")\n\t}\n\tif !foundRows {\n\t\treturn nil, errors.New(\"cachebench: Hugging Face response has no rows field\")\n\t}\n\treturn rows, nil\n}\n\nfunc decodeOneJSON(raw []byte, destination any) error {\n\tif !validUniqueJSONObject(raw) {\n\t\treturn errors.New(\"duplicate or invalid JSON\")","sourceCodeStart":266,"sourceCodeEnd":302,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/766dce6b1394ebb56a3090748d5a0240a5aefb36/cacheengine/cachebench/corpus.go#L266-L302","documentation":"Raised in readHFRows when, after consuming the rows elements, the closing token is not ']'. The rows array was never terminated (truncated input, nested bracket mismatch, or trailing junk inside the array).","triggerScenarios":"Thrown at cacheengine/cachebench/corpus.go:284 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the JSON with a strict validator such as jq . to locate the unbalanced bracket","Verify the input was not cut off by the MaxInputBytes limit or a partial download","Ensure no row object contains an unescaped ']' that broke the structure"],"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"}