{"record":{"id":"449a9a5f579752ac","repo":"plandex-ai/plandex","slug":"prompt-message-isn-t-set","errorCode":null,"errorMessage":"Prompt message isn't set","messagePattern":"Prompt message isn't set","errorType":"http","errorClass":null,"httpStatus":500,"severity":"error","filePath":"app/server/model/plan/tell_exec.go","lineNumber":362,"sourceCode":"\n\t\tactive.StreamDoneCh <- &shared.ApiError{\n\t\t\tType:   shared.ApiErrorTypeOther,\n\t\t\tStatus: http.StatusInternalServerError,\n\t\t\tMsg:    \"Token limit exceeded before adding conversation\",\n\t\t}\n\t\treturn\n\t}\n\n\tif !state.addConversationMessages() {\n\t\treturn\n\t}\n\n\t// add the prompt message to the end of the messages slice\n\tif promptMessage != nil {\n\t\tstate.messages = append(state.messages, *promptMessage)\n\t} else {\n\t\tlog.Println(\"promptMessage is nil\")\n\t\tgo notify.NotifyErr(notify.SeverityError, fmt.Errorf(\"promptMessage is nil\"))\n\n\t\tactive.StreamDoneCh <- &shared.ApiError{\n\t\t\tType:   shared.ApiErrorTypeOther,\n\t\t\tStatus: http.StatusInternalServerError,\n\t\t\tMsg:    \"Prompt message isn't set\",\n\t\t}\n\t\treturn\n\t}\n\n\tstate.replyId = uuid.New().String()\n\tstate.replyParser = types.NewReplyParser()\n\n\tif missingFileResponse != \"\" && !state.handleMissingFileResponse(unfinishedSubtaskReasoning) {\n\t\treturn\n\t}\n\n\t// filter out any messages that are empty\n\tstate.messages = model.FilterEmptyMessages(state.messages)","sourceCodeStart":344,"sourceCodeEnd":380,"githubUrl":"https://github.com/plandex-ai/plandex/blob/e2d772072efadbe41d2946d97d79be55532dbab5/app/server/model/plan/tell_exec.go#L344-L380","documentation":"Thrown when the promptMessage produced by state.resolvePromptMessage is nil at the point where execTellPlan appends it to the messages slice. The library treats a nil prompt as an unrecoverable internal state bug — no user prompt can be sent to the LLM — so it reports the error, sends a 500 ApiError on StreamDoneCh, and returns.","triggerScenarios":"resolvePromptMessage returned ok=true earlier but produced a nil message (e.g. empty prompt input or an internal branch that fails to build the ExtendedChatMessage), or the prompt message pointer was invalidated between resolution and use.","commonSituations":"Sending a tell request with empty/whitespace-only prompt text; internal refactors changing resolvePromptMessage semantics; race where the prompt is cleared mid-request.","solutions":["Re-send the tell request with a non-empty prompt","Check resolvePromptMessage logic for branches that can return ok=true with a nil message","Upgrade/patch the plan model code where the nil check happens too late (after token estimation uses *promptMessage)","Report to maintainers with server logs if prompt was non-empty"],"exampleFix":"// before\npromptMessage, ok := state.resolvePromptMessage(unfinishedSubtaskReasoning)\nif !ok { return }\n// after: fail fast with a clear message before using it\npromptMessage, ok := state.resolvePromptMessage(unfinishedSubtaskReasoning)\nif !ok || promptMessage == nil {\n    active.StreamDoneCh <- &shared.ApiError{Type: shared.ApiErrorTypeOther, Status: http.StatusBadRequest, Msg: \"prompt is empty\"}\n    return\n}","handlingStrategy":"validation","validationCode":"if strings.TrimSpace(prompt) == \"\" {\n    return errors.New(\"prompt must be a non-empty string before calling Tell\")\n}","typeGuard":null,"tryCatchPattern":"if apiErr := <-active.StreamDoneCh; apiErr != nil && strings.Contains(apiErr.Msg, \"Prompt message isn't set\") {\n    // resend with a valid non-empty prompt\n}","preventionTips":["Always validate prompt text is non-empty/whitespace-free before invoking Tell","Add an early nil/ok check right after resolvePromptMessage","Cover resolvePromptMessage branches with tests asserting a non-nil message on ok==true"],"tags":["internal-state","prompt","plan","nil-pointer"],"backgroundTag":"missing-required-argument","analyzedSha":"e2d772072efadbe41d2946d97d79be55532dbab5","analyzedAt":"2026-09-05T20:56:53.631Z","contentChangedAt":"2026-09-05T20:56:53.631Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}