plandex-ai/plandex · error

no current project

Error message

no current project

What it means

WriteCurrentPlan requires both a selected project (CurrentProjectId) and a valid HomeCurrentPlanPath; if either is empty it returns 'no current project', meaning there is no project context in which to record the current plan.

Source

Thrown at app/cli/lib/plans.go:20

import (
	"encoding/json"
	"fmt"
	"os"
	"path/filepath"
	"plandex-cli/auth"
	"plandex-cli/fs"
	"plandex-cli/types"
	"sync"
)

func WriteCurrentPlan(id string) error {
	if fs.HomePlandexDir == "" {
		return fmt.Errorf("HomePlandexDir not set")
	}

	if CurrentProjectId == "" || HomeCurrentPlanPath == "" {
		return fmt.Errorf("no current project")
	}

	var currentPlanSettingsByAccount *types.CurrentPlanSettingsByAccount

	bytes, err := os.ReadFile(HomeCurrentPlanPath)
	if err == nil {
		err = json.Unmarshal(bytes, &currentPlanSettingsByAccount)
		if err != nil {
			return fmt.Errorf("error unmarshalling current-plans-v2.json: %v", err)
		}
	} else if !os.IsNotExist(err) {
		return fmt.Errorf("error checking if current-plans-v2.json exists: %v", err)
	}

	if currentPlanSettingsByAccount == nil {
		currentPlanSettingsByAccount = &types.CurrentPlanSettingsByAccount{}
	}

View on GitHub (pinned to e2d772072e)

Solutions

  1. Run `plandex projects` / connect or create a project first so CurrentProjectId is set
  2. cd into your Plandex project directory before running `cd`/`new`
  3. Re-initialize Plandex in the directory (plandex init) to restore HomeCurrentPlanPath
  4. If state is corrupted, remove the stale current-plan/current-project files under HomePlandexDir and reconnect

Example fix

// before
$ cd /tmp && plandex cd myplan
error: no current project
// after
$ cd ~/my-project && plandex cd myplan
Defensive patterns

Strategy: validation

Validate before calling

if lib.CurrentProjectId == "" || lib.HomeCurrentPlanPath == "" {
	return fmt.Errorf("no current project: run plandex init inside a project directory first")
}
if err := lib.WriteCurrentPlan(planId); err != nil {
	return err
}

Type guard

func hasProjectContext() bool {
	return lib.CurrentProjectId != "" && lib.HomeCurrentPlanPath != ""
}

Try / catch

if err := lib.WriteCurrentPlan(id); err != nil {
	if err.Error() == "no current project" {
		// prompt user to cd into a project / run plandex init
	}
	return err
}

Prevention

When it happens

Trigger: Calling `plandex cd <plan>` or `new` outside a project directory / before connecting to a project, so CurrentProjectId is empty or HomeCurrentPlanPath was never set during init.

Common situations: Running plan commands outside any Plandex project; corrupted or deleted current-project state file under HomePlandexDir; fresh install where no project was ever created or joined.

Related errors


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