{"record":{"id":"abb0085afa28bc7f","repo":"plandex-ai/plandex","slug":"error-creating-plan-v","errorCode":null,"errorMessage":"error creating plan: %v","messagePattern":"error creating plan: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"app/cli/cmd/new.go","lineNumber":53,"sourceCode":"\n\tAddNewPlanFlags(newCmd)\n}\n\nfunc new(cmd *cobra.Command, args []string) {\n\tauth.MustResolveAuthWithOrg()\n\tlib.MustResolveOrCreateProject()\n\n\tterm.StartSpinner(\"\")\n\n\terrCh := make(chan error, 2)\n\n\tvar planId string\n\tvar config *shared.PlanConfig\n\n\tgo func() {\n\t\tres, apiErr := api.Client.CreatePlan(lib.CurrentProjectId, shared.CreatePlanRequest{Name: name})\n\t\tif apiErr != nil {\n\t\t\terrCh <- fmt.Errorf(\"error creating plan: %v\", apiErr.Msg)\n\t\t\treturn\n\t\t}\n\t\tplanId = res.Id\n\t\terrCh <- nil\n\t}()\n\n\tgo func() {\n\t\tvar apiErr *shared.ApiError\n\t\tconfig, apiErr = api.Client.GetDefaultPlanConfig()\n\t\tif apiErr != nil {\n\t\t\terrCh <- fmt.Errorf(\"error getting plan config: %v\", apiErr.Msg)\n\t\t\treturn\n\t\t}\n\t\terrCh <- nil\n\t}()\n\n\tfor i := 0; i < 2; i++ {\n\t\terr := <-errCh","sourceCodeStart":35,"sourceCodeEnd":71,"githubUrl":"https://github.com/plandex-ai/plandex/blob/e2d772072efadbe41d2946d97d79be55532dbab5/app/cli/cmd/new.go#L35-L71","documentation":"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.","triggerScenarios":"CreatePlan(lib.CurrentProjectId, CreatePlanRequest{Name: name}) returns non-nil *shared.ApiError — e.g. invalid project id, name conflict, auth failure, or server error.","commonSituations":"CurrentProjectId stale/pointing to a deleted project, plan name already exists, expired auth token, network interruption.","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"],"exampleFix":"// before\nres, apiErr := api.Client.CreatePlan(lib.CurrentProjectId, shared.CreatePlanRequest{Name: name})\nif apiErr != nil {\n    errCh <- fmt.Errorf(\"error creating plan: %v\", apiErr.Msg)\n    return\n}\n// after\nres, apiErr := api.Client.CreatePlan(lib.CurrentProjectId, shared.CreatePlanRequest{Name: name})\nif apiErr != nil {\n    errCh <- fmt.Errorf(\"error creating plan (project %s): %s\", lib.CurrentProjectId, apiErr.Msg)\n    return\n}","handlingStrategy":"validation","validationCode":"if lib.CurrentProjectId == \"\" {\n    return fmt.Errorf(\"no current project set; run in a project directory or 'set-project' first\")\n}\nif strings.TrimSpace(name) == \"\" {\n    return fmt.Errorf(\"plan name must not be empty\")\n}","typeGuard":"var apiErr *shared.ApiError\nres, apiErr := api.Client.CreatePlan(lib.CurrentProjectId, shared.CreatePlanRequest{Name: name})\nif apiErr != nil {\n    // handle\n}","tryCatchPattern":null,"preventionTips":["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"],"tags":["network","api","cli","plan-creation"],"backgroundTag":"api-request-failed","analyzedSha":"e2d772072efadbe41d2946d97d79be55532dbab5","analyzedAt":"2026-09-05T20:56:53.631Z","contentChangedAt":"2026-09-05T20:56:53.631Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}