sipeed/picoclaw · error
parse file
Error message
parse file %s: %w
What it means
Wrapped json.Unmarshal failure in LoadDataset: a .json file in the data dir was read but does not decode into []LocomoSample — typically a schema mismatch (wrong JSON shape, a single object instead of an array, or an unexpected field type such as a non-string answer field). %s identifies the offending file.
Solutions
- Inspect the named file and validate it against the LocomoSample schema
- Ensure files contain a top-level array of sample objects
- Pre-validate files with a JSON linter or jq before running ingest/eval
- Fix the unmarshal target types (e.g. answer fields that may be string, number, or raw JSON) to match the actual data
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at cmd/membench/locomo.go:72 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of sipeed/picoclaw@49183d7e8d (2026-08-15).
Data as JSON: /api/errors/38bae25b32c1baf8.
Report an issue: GitHub.
Appendix: source
Thrown at cmd/membench/locomo.go:72
// LoadDataset reads all JSON files from dataDir and returns parsed samples.
func LoadDataset(dataDir string) ([]LocomoSample, error) {
entries, err := os.ReadDir(dataDir)
if err != nil {
return nil, fmt.Errorf("read data dir %s: %w", dataDir, err)
}
var samples []LocomoSample
for _, entry := range entries {
if !entry.IsDir() && strings.HasSuffix(entry.Name(), ".json") {
path := filepath.Join(dataDir, entry.Name())
data, err := os.ReadFile(path)
if err != nil {
return nil, fmt.Errorf("read file %s: %w", path, err)
}
var batch []LocomoSample
if err := json.Unmarshal(data, &batch); err != nil {
return nil, fmt.Errorf("parse file %s: %w", path, err)
}
samples = append(samples, batch...)
}
}
return samples, nil
}
// GetSessionNames returns sorted session keys (session_1, session_2, ...) from conversation.
func GetSessionNames(conv map[string]json.RawMessage) []string {
var names []string
for k := range conv {
if strings.HasPrefix(k, "session_") && !strings.Contains(k, "_date_time") {
names = append(names, k)
}
}
sort.Slice(names, func(i, j int) bool {
ni := sessionNum(names[i])
nj := sessionNum(names[j])View on GitHub (pinned to 49183d7e8d)