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)
			return

View on GitHub (pinned to e2d772072e)

Solutions

  1. Inspect the wrapped error for the specific failing path
  2. Fix permissions on the plan's results directory
  3. Remove or repair corrupt/partial result JSON files
  4. Ensure only one server instance manages the plans data dir to avoid delete races
  5. 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

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


AI-assisted analysis of plandex-ai/plandex@e2d772072e (2026-09-05). Data as JSON: /api/errors/b66885cabf03ab03. Report an issue: GitHub.