plandex-ai/plandex · error

failed to list context: %s

Error message

failed to list context: %s

What it means

CheckOutdatedContextWithOutput fetches the current plan's context via api.Client.ListContext when it wasn't supplied; a failure there is wrapped with this message after stopping the spinner. It means the tool cannot determine whether context files are outdated because the server context listing is unavailable.

Source

Thrown at app/cli/lib/context_update.go:37

	"github.com/fatih/color"
	"github.com/olekukonko/tablewriter"
)

func CheckOutdatedContextWithOutput(quiet, autoConfirm bool, maybeContexts []*shared.Context, projectPaths *types.ProjectPaths) (contextOutdated, updated bool, err error) {
	if !quiet {
		term.StartSpinner("🔬 Checking context...")
	}

	var contexts []*shared.Context

	if maybeContexts != nil {
		contexts = maybeContexts
	} else {
		res, err := api.Client.ListContext(CurrentPlanId, CurrentBranch)
		if err != nil {
			term.StopSpinner()
			return false, false, fmt.Errorf("failed to list context: %s", err)
		}
		contexts = res
	}

	outdatedRes, err := CheckOutdatedContext(contexts, projectPaths)
	if err != nil {
		term.StopSpinner()
		return false, false, fmt.Errorf("failed to check outdated context: %s", err)
	}

	if !quiet {
		term.StopSpinner()
	}

	if len(outdatedRes.UpdatedContexts) == 0 && len(outdatedRes.RemovedContexts) == 0 {
		if !quiet {
			fmt.Println("✅ Context is up to date")
		}

View on GitHub (pinned to e2d772072e)

Solutions

  1. Check network connectivity and retry the apply/list command
  2. Re-authenticate if the session expired
  3. Verify the plan and branch still exist server-side (plandex plans / branches list)

Example fix

// before
res, err := api.Client.ListContext(CurrentPlanId, CurrentBranch)
if err != nil {
    term.StopSpinner()
    return false, false, fmt.Errorf("failed to list context: %s", err)
}
// after — retry once on transient errors
res, err := api.Client.ListContext(CurrentPlanId, CurrentBranch)
if err != nil {
    res, err = api.Client.ListContext(CurrentPlanId, CurrentBranch)
    if err != nil {
        term.StopSpinner()
        return false, false, fmt.Errorf("failed to list context: %s", err)
    }
}
Defensive patterns

Strategy: retry

Validate before calling

if CurrentPlanId == "" {
    return fmt.Errorf("no plan selected; cannot check outdated context")
}
if err := checkApiReachable(); err != nil {
    return fmt.Errorf("API unreachable: %w", err)
}

Try / catch

res, err := api.Client.ListContext(CurrentPlanId, CurrentBranch)
if err != nil {
    time.Sleep(2 * time.Second)
    res, err = api.Client.ListContext(CurrentPlanId, CurrentBranch)
    if err != nil {
        term.StopSpinner()
        return false, false, fmt.Errorf("failed to list context: %s", err)
    }
}

Prevention

When it happens

Trigger: maybeContexts is nil and api.Client.ListContext(CurrentPlanId, CurrentBranch) returns an error — network failure, auth expiry, deleted plan/branch, or server 5xx. Reached from MustApplyPlanAttempt before applying a plan.

Common situations: Offline work or flaky connection before applying a plan; plan deleted by a teammate; stale session after long idle.

Understand the failure class

Background: "API request failed": what wrapped HTTP errors from external APIs mean and how to find the real cause — this error's family across 29 libraries.

Related errors


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