{"record":{"id":"bc3d976cedc24d96","repo":"sipeed/picoclaw","slug":"read-data-dir-s-w","errorCode":null,"errorMessage":"read data dir %s: %w","messagePattern":"read data dir (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/membench/locomo.go","lineNumber":59,"sourceCode":"\t\tvar s string\n\t\tif err := json.Unmarshal(qa.Answer, &s); err == nil {\n\t\t\treturn s\n\t\t}\n\t\tvar n json.Number\n\t\tif err := json.Unmarshal(qa.Answer, &n); err == nil {\n\t\t\treturn n.String()\n\t\t}\n\t\treturn strings.Trim(string(qa.Answer), `\"`)\n\t}\n\t// Fallback to adversarial_answer (category 5)\n\treturn qa.AdversarialAnswer\n}\n\n// LoadDataset reads all JSON files from dataDir and returns parsed samples.\nfunc LoadDataset(dataDir string) ([]LocomoSample, error) {\n\tentries, err := os.ReadDir(dataDir)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"read data dir %s: %w\", dataDir, err)\n\t}\n\n\tvar samples []LocomoSample\n\tfor _, entry := range entries {\n\t\tif !entry.IsDir() && strings.HasSuffix(entry.Name(), \".json\") {\n\t\t\tpath := filepath.Join(dataDir, entry.Name())\n\t\t\tdata, err := os.ReadFile(path)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"read file %s: %w\", path, err)\n\t\t\t}\n\t\t\tvar batch []LocomoSample\n\t\t\tif err := json.Unmarshal(data, &batch); err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"parse file %s: %w\", path, err)\n\t\t\t}\n\t\t\tsamples = append(samples, batch...)\n\t\t}\n\t}\n\treturn samples, nil","sourceCodeStart":41,"sourceCodeEnd":77,"githubUrl":"https://github.com/sipeed/picoclaw/blob/49183d7e8daed0dba89ddbb6fcb60089401d9680/cmd/membench/locomo.go#L41-L77","documentation":"Error \"read data dir %s: %w\" thrown in sipeed/picoclaw.","triggerScenarios":"Thrown at cmd/membench/locomo.go:59 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"49183d7e8daed0dba89ddbb6fcb60089401d9680","analyzedAt":"2026-08-15T21:55:41.315Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}