plandex-ai/plandex · error

error getting current plan files: %v

Error message

error getting current plan files: %v

What it means

After the four worker goroutines of GetCurrentPlanState succeed, the assembled planState's GetFiles() method is called to materialize the current plan files. If GetFiles returns an error (e.g. a file result cannot be resolved to concrete file content), it is wrapped as 'error getting current plan files: %v' and returned from GetCurrentPlanState.

Source

Thrown at app/server/db/result_helpers.go:301

	pendingContextsByPath := map[string]*shared.Context{}
	for path, context := range contextsByPath {
		pendingContextsByPath[path] = context.ToApi()
	}

	// log.Println("Pending contexts by path:", len(pendingContextsByPath))

	planState := &shared.CurrentPlanState{
		PlanResult:               planResult,
		ConvoMessageDescriptions: convoMessageDescriptions,
		ContextsByPath:           pendingContextsByPath,
		PlanApplies:              planApplies,
	}

	currentPlanFiles, err := planState.GetFiles()

	if err != nil {
		return nil, fmt.Errorf("error getting current plan files: %v", err)
	}

	planState.CurrentPlanFiles = currentPlanFiles

	return planState, nil
}

func GetConvoMessageDescriptions(orgId, planId string) ([]*ConvoMessageDescription, error) {
	var descriptions []*ConvoMessageDescription
	descriptionsDir := getPlanDescriptionsDir(orgId, planId)
	files, err := os.ReadDir(descriptionsDir)

	if err != nil {

		if os.IsNotExist(err) {
			return descriptions, nil
		}

View on GitHub (pinned to e2d772072e)

Solutions

  1. Look at the wrapped inner error from GetFiles to see which path or file result failed
  2. Verify the underlying file content for that path exists and is readable in the plan storage
  3. Remove or repair the corrupt plan file result record, then re-run the call
  4. Check for conflicted results (IsPending) that GetFiles cannot resolve and resolve/reject them first
  5. Retry after a transient storage error; the four goroutines have already succeeded, so the failure is isolated to file materialization

Example fix

// before
planState, err := GetCurrentPlanState(params)
if err != nil {
    return nil, err
}
// after
planState, err := GetCurrentPlanState(params)
if err != nil {
    if strings.Contains(err.Error(), "error getting current plan files") {
        log.Printf("plan files unavailable, using partial state: %v", err)
        return planStatePartial(params), nil
    }
    return nil, err
}
Defensive patterns

Strategy: fallback

Validate before calling

// probe file materialization before the full call
planState, err := GetCurrentPlanState(params)
if err == nil {
    if _, ferr := planState.GetFiles(); ferr != nil {
        log.Printf("plan files will fail to materialize: %v", ferr)
    }
}

Type guard

func isPlanFilesError(err error) bool {
    return err != nil && strings.Contains(err.Error(), "error getting current plan files")
}

Try / catch

planState, err := GetCurrentPlanState(params)
if err != nil {
    if isPlanFilesError(err) {
        log.Printf("plan files unavailable, using partial state: %v", err)
        planState.CurrentPlanFiles = nil
        return planState, nil
    }
    return nil, err
}

Prevention

When it happens

Trigger: Calling GetCurrentPlanState (via invalidateConflictedResults, ClearContext, GetPlanDiffs, etc.) when the assembled CurrentPlanState holds plan file results or applies whose file contents cannot be loaded/merged by planState.GetFiles().

Common situations: Plan file results referencing files whose content blobs are missing from storage; corrupted file-result records after a crashed apply; diff/merge failure when combining applied replacements; disk read errors on the underlying file store.

Related errors


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