plandex-ai/plandex · error

no current plan

Error message

no current plan

What it means

loadCurrentBranch requires a currently selected plan. If CurrentPlanId is empty (no plan has been created/selected in this workspace), it returns 'no current plan' instead of reading plan-specific settings-v2.json.

Source

Thrown at app/cli/lib/current.go:176

		if err != nil {
			term.OutputErrorAndExit("error loading current branch: %v", err)
		}

		if CurrentBranch == "" {
			err = WriteCurrentBranch("main")

			if err != nil {
				term.OutputErrorAndExit("error setting current branch: %v", err)
			}
		}
	}
}

func loadCurrentBranch() error {
	// Load plan-specific settings
	if CurrentPlanId == "" {
		return fmt.Errorf("no current plan")
	}

	path := filepath.Join(HomeCurrentProjectDir, CurrentPlanId, "settings-v2.json")

	// Check if the file exists
	_, err := os.Stat(path)

	if os.IsNotExist(err) {
		return nil
	} else if err != nil {
		return fmt.Errorf("error checking if settings-v2.json exists: %v", err)
	}

	fileBytes, err := os.ReadFile(path)
	if err != nil {
		term.OutputErrorAndExit("error reading settings-v2.json: %v", err)
	}

View on GitHub (pinned to e2d772072e)

Solutions

  1. Create a new plan with the CLI's plan-creation command
  2. Select/switch to an existing plan so CurrentPlanId is set
  3. Check the current-project state directory to confirm any plan exists
  4. Guard the command: skip plan-dependent logic when no plan is selected

Example fix

// before
current, err := MustLoadCurrentPlan()
// after: check plan exists first
if CurrentPlanId == "" {
    term.OutputErrorAndExit("no plan selected — run the plan creation command first")
}
current, err := MustLoadCurrentPlan()
Defensive patterns

Strategy: validation

Validate before calling

if CurrentPlanId == "" {
    return fmt.Errorf("no plan selected — create or select a plan first")
}

Try / catch

current, err := MustLoadCurrentPlan()
if err != nil && err.Error() == "no current plan" {
    return promptCreateOrSelectPlan() // recover by onboarding
}

Prevention

When it happens

Trigger: Calling MustLoadCurrentPlan (which calls loadCurrentBranch) when CurrentPlanId == "" — i.e. before any plan is created or after the current-plan selection was never initialized in this project directory.

Common situations: Running a plan-dependent CLI command in a fresh project without creating a plan first; cleared/missing local state; running from a directory where plan selection was never saved; corrupted local config wiping CurrentPlanId.

Related errors


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