plandex-ai/plandex · error
error getting plan file results: %v
Error message
error getting plan file results: %v
What it means
Inside the first worker goroutine of GetFullCurrentPlanStateParams, GetPlanFileResults reads every JSON file in the plan's results directory. Any error other than a missing directory (which is treated as empty) is wrapped with this message and sent to the caller.
Source
Thrown at app/server/db/result_helpers.go:82
func GetFullCurrentPlanStateParams(orgId, planId string) (CurrentPlanStateParams, error) {
errCh := make(chan error, 3)
var results []*PlanFileResult
var convoMessageDescriptions []*ConvoMessageDescription
var contexts []*Context
go func() {
defer func() {
if r := recover(); r != nil {
log.Printf("panic in GetFullCurrentPlanStateParams: %v\n%s", r, debug.Stack())
errCh <- fmt.Errorf("panic in GetFullCurrentPlanStateParams: %v\n%s", r, debug.Stack())
runtime.Goexit() // don't allow outer function to continue and double-send to channel
}
}()
res, err := GetPlanFileResults(orgId, planId)
if err != nil {
errCh <- fmt.Errorf("error getting plan file results: %v", err)
return
}
results = res
errCh <- nil
}()
go func() {
defer func() {
if r := recover(); r != nil {
log.Printf("panic in GetFullCurrentPlanStateParams: %v\n%s", r, debug.Stack())
errCh <- fmt.Errorf("panic in GetFullCurrentPlanStateParams: %v\n%s", r, debug.Stack())
runtime.Goexit() // don't allow outer function to continue and double-send to channel
}
}()
res, err := GetConvoMessageDescriptions(orgId, planId)
if err != nil {
errCh <- fmt.Errorf("error getting latest plan build description: %v", err)
returnView on GitHub (pinned to e2d772072e)
Solutions
- Inspect the wrapped error for the specific failing path
- Fix permissions on the plan's results directory
- Remove or repair corrupt/partial result JSON files
- Ensure only one server instance manages the plans data dir to avoid delete races
- Treat 'error reading result files' children as data-corruption signals and re-sync storage from backup
Example fix
// before
if err != nil {
return CurrentPlanStateParams{}, err
}
// after
if err != nil {
log.Printf("plan file results unavailable for %s/%s: %v — continuing with empty state", orgId, planId, err)
return CurrentPlanStateParams{OrgId: orgId, PlanId: planId}, nil
} Defensive patterns
Strategy: fallback
Validate before calling
dir := getPlanResultsDir(orgId, planId)
if st, err := os.Stat(dir); err == nil && !st.IsDir() {
return fmt.Errorf("results path is a file, not a directory: %s", dir)
} Type guard
func nilSafeResults(rs []*db.PlanFileResult) []*db.PlanFileResult {
if rs == nil {
return []*db.PlanFileResult{}
}
return rs
} Try / catch
params, err := db.GetFullCurrentPlanStateParams(orgId, planId)
if err != nil && strings.Contains(err.Error(), "error getting plan file results") {
// degrade to empty plan state instead of failing the request
params = db.CurrentPlanStateParams{OrgId: orgId, PlanId: planId}
} Prevention
- Single-writer discipline: one server instance owns the plans data dir
- Treat os.IsNotExist as empty (the code already does) — fix other errnos at the infra level
- Back up plan data dirs and verify restorability
- Detect and quarantine corrupt JSON files with a periodic scan job
- Watch logs for partial-write symptoms (truncated JSON) after crashes
When it happens
Trigger: GetPlanFileResults fails while GetFullCurrentPlanStateParams runs: unreadable results directory (EACCES), a result file deleted between ReadDir and ReadFile, unreadable/corrupt JSON file, or a panic in one of its per-file goroutines.
Common situations: Permissions changed on the plans data dir; a result file partially written by a crashed process; another server instance cleaning up files concurrently; disk I/O errors.
Understand the failure class
Background: "failed to read file", EACCES, ENOENT and "could not read <path>" errors: when a program can't read a file from disk — this error's family across 49 libraries.
Related errors
- error getting latest plan build description: %v
- error getting contexts: %v
- error unmarshalling settings-v2.json: %v
- error reading settings-v2.json: %v
- failed to seek in temporary file: %w
AI-assisted analysis of plandex-ai/plandex@e2d772072e (2026-09-05).
Data as JSON: /api/errors/b66885cabf03ab03.
Report an issue: GitHub.