sipeed/picoclaw · error
read data dir
Error message
read data dir %s: %w
What it means
Wrapped filesystem error from os.ReadDir inside LoadDataset: the --data directory itself cannot be listed, almost always because the path does not exist, is a file rather than a directory, or lacks read permission. The %s is the offending dataDir path and %w preserves the underlying PathError for errors.Is checks.
Solutions
- Verify the --data path exists and is a directory (e.g. ls <path>)
- Check read permission on the directory for the running user
- Pass an absolute path or run from the repo root so the relative dir resolves
- Inspect errors.Is(err, fs.ErrNotExist / fs.ErrPermission) on the unwrapped cause to distinguish causes programmatically
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at cmd/membench/locomo.go:59 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/bc3d976cedc24d96.
Report an issue: GitHub.
Appendix: source
Thrown at cmd/membench/locomo.go:59
var s string
if err := json.Unmarshal(qa.Answer, &s); err == nil {
return s
}
var n json.Number
if err := json.Unmarshal(qa.Answer, &n); err == nil {
return n.String()
}
return strings.Trim(string(qa.Answer), `"`)
}
// Fallback to adversarial_answer (category 5)
return qa.AdversarialAnswer
}
// 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, nilView on GitHub (pinned to 49183d7e8d)