plandex-ai/plandex · error
error reading result files: %v
Error message
error reading result files: %v
What it means
Aggregate error for GetPlanFileResults: when any per-file goroutine reports a read, unmarshal, or panic error on errCh, the collection loop returns immediately with this wrapper, discarding partially collected results.
Source
Thrown at app/server/db/result_helpers.go:430
return
}
var result PlanFileResult
err = json.Unmarshal(bytes, &result)
if err != nil {
errCh <- fmt.Errorf("error unmarshalling result file: %v", err)
return
}
resultCh <- &result
}(file)
}
for i := 0; i < len(files); i++ {
select {
case err := <-errCh:
return nil, fmt.Errorf("error reading result files: %v", err)
case result := <-resultCh:
results = append(results, result)
}
}
sort.Slice(results, func(i, j int) bool {
return results[i].CreatedAt.Before(results[j].CreatedAt)
})
return results, nil
}
func GetPlanFileResultById(orgId, planId, resultId string) (*PlanFileResult, error) {
resultsDir := getPlanResultsDir(orgId, planId)
bytes, err := os.ReadFile(filepath.Join(resultsDir, resultId+".json"))
if err != nil {View on GitHub (pinned to e2d772072e)
Solutions
- Fix the root cause named in the wrapped inner error (path/JSON detail is preserved)
- Quarantine or delete malformed result files
- Harden: collect errors for all files and return partial results with warnings instead of first-error-abort
- Add monitoring for recurring corruption to catch partial-write bugs
Defensive patterns
Strategy: try-catch
Validate before calling
for _, f := range resultFiles(dir) {
if !json.Valid(mustRead(f)) {
log.Printf("pre-check: malformed result file %s — quarantine before calling", f)
}
} Try / catch
results, err := db.GetPlanFileResults(orgId, planId)
if err != nil {
// inner error names the failing file; fix/quarantine then retry once
return fmt.Errorf("GetPlanFileResults: %w", err)
} Prevention
- Quarantine bad files instead of deleting (preserve for debugging)
- Alert on corruption frequency — usually signals partial writes
- Test upgrades against old result file versions
When it happens
Trigger: Any child error [513]/[514]/[515] fires while the main loop is collecting len(files) results.
Common situations: A single stale result file breaks plan listing used by RejectPlanFile; flaky disk causes intermittent failures across many files.
Understand the failure class
Background: "failed to unmarshal" / json.Unmarshal errors: why parsing a response into a Go struct fails and how to fix it — this error's family across 23 libraries.
Related errors
- error reading description files: %v
- error applying plan: %v
- error deleting pending results: %v
- error rejecting plan files: %v
- error updating context: %v
AI-assisted analysis of plandex-ai/plandex@e2d772072e (2026-09-05).
Data as JSON: /api/errors/814fa8a12ff2a1b0.
Report an issue: GitHub.