plandex-ai/plandex · error
error creating plan: %v
Error message
error creating plan: %v
What it means
This error wraps a failure from api.Client.CreatePlan(), which asks the server to create a new plan for the current project. The call runs in a goroutine during the 'new' command; any API error is forwarded into errCh as this message. It indicates the plan-creation request failed server-side or at the transport level.
Source
Thrown at app/cli/cmd/new.go:53
AddNewPlanFlags(newCmd)
}
func new(cmd *cobra.Command, args []string) {
auth.MustResolveAuthWithOrg()
lib.MustResolveOrCreateProject()
term.StartSpinner("")
errCh := make(chan error, 2)
var planId string
var config *shared.PlanConfig
go func() {
res, apiErr := api.Client.CreatePlan(lib.CurrentProjectId, shared.CreatePlanRequest{Name: name})
if apiErr != nil {
errCh <- fmt.Errorf("error creating plan: %v", apiErr.Msg)
return
}
planId = res.Id
errCh <- nil
}()
go func() {
var apiErr *shared.ApiError
config, apiErr = api.Client.GetDefaultPlanConfig()
if apiErr != nil {
errCh <- fmt.Errorf("error getting plan config: %v", apiErr.Msg)
return
}
errCh <- nil
}()
for i := 0; i < 2; i++ {
err := <-errChView on GitHub (pinned to e2d772072e)
Solutions
- Verify lib.CurrentProjectId is valid and the project still exists
- Re-authenticate if the token may have expired
- Choose a different plan name if a conflict is reported
- Check API server availability and retry
Example fix
// before
res, apiErr := api.Client.CreatePlan(lib.CurrentProjectId, shared.CreatePlanRequest{Name: name})
if apiErr != nil {
errCh <- fmt.Errorf("error creating plan: %v", apiErr.Msg)
return
}
// after
res, apiErr := api.Client.CreatePlan(lib.CurrentProjectId, shared.CreatePlanRequest{Name: name})
if apiErr != nil {
errCh <- fmt.Errorf("error creating plan (project %s): %s", lib.CurrentProjectId, apiErr.Msg)
return
} Defensive patterns
Strategy: validation
Validate before calling
if lib.CurrentProjectId == "" {
return fmt.Errorf("no current project set; run in a project directory or 'set-project' first")
}
if strings.TrimSpace(name) == "" {
return fmt.Errorf("plan name must not be empty")
} Type guard
var apiErr *shared.ApiError
res, apiErr := api.Client.CreatePlan(lib.CurrentProjectId, shared.CreatePlanRequest{Name: name})
if apiErr != nil {
// handle
} Prevention
- Ensure a valid project is current before creating plans
- Validate plan name (non-empty, unique) client-side
- Keep auth fresh
- Surface apiErr.Msg to the user
When it happens
Trigger: CreatePlan(lib.CurrentProjectId, CreatePlanRequest{Name: name}) returns non-nil *shared.ApiError — e.g. invalid project id, name conflict, auth failure, or server error.
Common situations: CurrentProjectId stale/pointing to a deleted project, plan name already exists, expired auth token, network interruption.
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
- error signing in: %v
- error listing contexts: %v
- error getting context body: %v
- error getting default config: %v
- error getting plan config: %v
AI-assisted analysis of plandex-ai/plandex@e2d772072e (2026-09-05).
Data as JSON: /api/errors/abb0085afa28bc7f.
Report an issue: GitHub.