{"record":{"id":"132faf4f5135b34a","repo":"plandex-ai/plandex","slug":"error-getting-tell-sys-prompt-for-dry-run-token-ca","errorCode":null,"errorMessage":"Error getting tell sys prompt for dry run token calculation","messagePattern":"Error getting tell sys prompt for dry run token calculation","errorType":"http","errorClass":null,"httpStatus":500,"severity":"error","filePath":"app/server/model/plan/tell_exec.go","lineNumber":625,"sourceCode":"\t\thasAssistantReply:   state.hasAssistantReply,\n\t\tmodelContext:        state.modelContext,\n\t\tactivePlan:          state.activePlan,\n\t}\n\n\tsysParts, err := clone.getTellSysPrompt(getTellSysPromptParams{\n\t\tcontextTokenLimit:    tentativeMaxTokens,\n\t\tdryRunWithoutContext: true,\n\t})\n\n\tif err != nil {\n\t\tlog.Printf(\"error getting tell sys prompt for dry run token calculation: %v\", err)\n\n\t\tmsg := \"Error getting tell sys prompt for dry run token calculation\"\n\t\tif err.Error() == AllTasksCompletedMsg {\n\t\t\tmsg = \"There's no current task to implement. Try a prompt instead of the 'continue' command.\"\n\t\t\tgo notify.NotifyErr(notify.SeverityInfo, msg)\n\t\t} else {\n\t\t\tgo notify.NotifyErr(notify.SeverityError, fmt.Errorf(\"error getting tell sys prompt for dry run token calculation: %v\", err))\n\t\t}\n\n\t\tstate.activePlan.StreamDoneCh <- &shared.ApiError{\n\t\t\tType:   shared.ApiErrorTypeOther,\n\t\t\tStatus: http.StatusInternalServerError,\n\t\t\tMsg:    msg,\n\t\t}\n\t\treturn false, 0\n\t}\n\n\tclone.messages = []types.ExtendedChatMessage{\n\t\t{\n\t\t\tRole:    openai.ChatMessageRoleSystem,\n\t\t\tContent: sysParts,\n\t\t},\n\t}\n\n\tpromptMessage, ok := clone.resolvePromptMessage(unfinishedSubtaskReasoning)","sourceCodeStart":607,"sourceCodeEnd":643,"githubUrl":"https://github.com/plandex-ai/plandex/blob/e2d772072efadbe41d2946d97d79be55532dbab5/app/server/model/plan/tell_exec.go#L607-L643","documentation":"Thrown during the dry-run token calculation path (dryRunCalculateTokensWithoutContext) when generating the tell system prompt fails. Special case: if the underlying error equals AllTasksCompletedMsg, it is downgraded to an informational notification telling the user there is no current task and they should send a prompt instead of 'continue'; otherwise it's reported as a server error and a 500 ApiError is emitted.","triggerScenarios":"Calling the tell flow with 'continue' when no task is active (AllTasksCompletedMsg), or any failure building the sys prompt (missing plan summary/context data) during dry-run token estimation.","commonSituations":"User runs 'continue' after all implementation tasks finished; plan state missing a current task; corrupted plan summary causing prompt construction to fail.","solutions":["If the message says there's no current task: send a normal prompt instead of 'continue'","Check plan state has a valid current task/summary before continuing","Inspect server logs for the wrapped 'error getting tell sys prompt' detail to fix the underlying prompt-building failure"],"exampleFix":"// before\nplz continue  # all tasks done\n// error: Error getting tell sys prompt for dry run token calculation\n// after\nplz implement add login form  # start a new task, or add new tasks to the plan first","handlingStrategy":"try-catch","validationCode":"// before sending 'continue', confirm there is an active task\nif plan.CurrentTask == nil || plan.AllTasksCompleted() {\n    return errors.New(\"no active task; send a prompt instead of 'continue'\")\n}","typeGuard":null,"tryCatchPattern":"if apiErr := <-state.activePlan.StreamDoneCh; apiErr != nil {\n    if strings.Contains(apiErr.Msg, \"no current task\") {\n        // informational: switch to sending a prompt\n    } else if strings.Contains(apiErr.Msg, \"dry run token calculation\") {\n        // inspect server logs for wrapped sys-prompt build failure\n    }\n}","preventionTips":["Don't send 'continue' when all plan tasks are complete","Ensure plan has a valid current task and summary before continuing","Handle the AllTasksCompletedMsg case in UI to guide users to a prompt"],"tags":["tokens","dry-run","prompt","plan"],"backgroundTag":"no-active-task","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"}