plandex-ai/plandex · error
error reading results dir: %v
Error message
error reading results dir: %v
What it means
GetPlanFileResults lists the plan results directory via os.ReadDir (or similar); on failure it returns this wrapped error. A directory that does not exist is deliberately treated as an empty result, so this error only fires for genuine read failures.
Source
Thrown at app/server/db/result_helpers.go:390
return descriptions[i].CreatedAt.Before(descriptions[j].CreatedAt)
})
return descriptions, nil
}
func GetPlanFileResults(orgId, planId string) ([]*PlanFileResult, error) {
var results []*PlanFileResult
resultsDir := getPlanResultsDir(orgId, planId)
files, err := os.ReadDir(resultsDir)
if err != nil {
if os.IsNotExist(err) {
return results, nil
}
return nil, fmt.Errorf("error reading results dir: %v", err)
}
errCh := make(chan error, len(files))
resultCh := make(chan *PlanFileResult, len(files))
for _, file := range files {
// log.Printf("Result file: %s", file.Name())
go func(file os.DirEntry) {
defer func() {
if r := recover(); r != nil {
log.Printf("panic in GetPlanFileResults: %v\n%s", r, debug.Stack())
errCh <- fmt.Errorf("panic in GetPlanFileResults: %v\n%s", r, debug.Stack())
runtime.Goexit() // don't allow outer function to continue and double-send to channel
}
}()
bytes, err := os.ReadFile(filepath.Join(resultsDir, file.Name()))View on GitHub (pinned to e2d772072e)
Solutions
- Check the resolved results dir path printed via getPlanResultsDir for correct orgId/planId
- Verify directory permissions (read+execute bits) and that it is a directory, not a file
- Check mount/disk health (dmesg, df) if it is an I/O error
- Note: NotExist is intentionally treated as empty — confirm the error is genuinely a read failure
Defensive patterns
Strategy: fallback
Validate before calling
fi, err := os.Stat(resultsDir)
if err != nil || !fi.IsDir() {
// treat as no results; skip or recreate the directory
}
if err := unix.Access(resultsDir, unix.R_OK); err != nil {
log.Printf("results dir not readable: %v", err)
} Try / catch
results, err := db.GetPlanFileResults(orgId, planId)
if err != nil {
log.Printf("plan results unavailable: %v", err)
results = nil // degrade gracefully to empty result set
} Prevention
- Ensure the app creates the results dir (MkdirAll) before use
- Check volume mount permissions after deployments
- Never replace the results dir with a regular file
When it happens
Trigger: os.ReadDir on the plan results dir fails with a non-NotExist error: permission denied, path exists but is a file, I/O error, or ENOSPC.
Common situations: Wrong orgId/planId causing a weird path; results dir deleted or replaced by a file; restrictive file permissions after container/image changes; read-only volume mounts failing.
Related errors
- error walking directory: %s
- failed to check if %s exists: %s
- failed to read %s: %s
- failed to write %s: %s
- failed to remove %s: %s
AI-assisted analysis of plandex-ai/plandex@e2d772072e (2026-09-05).
Data as JSON: /api/errors/6facdc51253c99ee.
Report an issue: GitHub.