{"record":{"id":"a351bc1435caf4b0","repo":"plandex-ai/plandex","slug":"error-getting-tell-sys-prompt-v","errorCode":null,"errorMessage":"Error getting tell sys prompt: %v","messagePattern":"Error getting tell sys prompt: (.+?)","errorType":"http","errorClass":null,"httpStatus":500,"severity":"error","filePath":"app/server/model/plan/tell_exec.go","lineNumber":290,"sourceCode":"\t\t\t\t\tautoOnly:            true,\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t}\n\n\tgetTellSysPromptParams := getTellSysPromptParams{\n\t\tplanStageSharedMsgs:   planStageSharedMsgs,\n\t\tplanningPhaseOnlyMsgs: planningPhaseOnlyMsgs,\n\t\timplementationMsgs:    implementationMsgs,\n\t\tcontextTokenLimit:     tentativeMaxTokens,\n\t}\n\n\t// log.Println(\"getTellSysPromptParams:\\n\", spew.Sdump(getTellSysPromptParams))\n\n\tsysParts, err := state.getTellSysPrompt(getTellSysPromptParams)\n\tif err != nil {\n\t\tlog.Printf(\"Error getting tell sys prompt: %v\\n\", err)\n\t\tgo notify.NotifyErr(notify.SeverityError, fmt.Errorf(\"error getting tell sys prompt: %v\", err))\n\n\t\tactive.StreamDoneCh <- &shared.ApiError{\n\t\t\tType:   shared.ApiErrorTypeOther,\n\t\t\tStatus: http.StatusInternalServerError,\n\t\t\tMsg:    fmt.Sprintf(\"Error getting tell sys prompt: %v\", err),\n\t\t}\n\t\treturn\n\t}\n\n\t// log.Println(\"**sysPrompt:**\\n\", spew.Sdump(sysParts))\n\n\tstate.messages = []types.ExtendedChatMessage{\n\t\t{\n\t\t\tRole:    openai.ChatMessageRoleSystem,\n\t\t\tContent: sysParts,\n\t\t},\n\t}\n","sourceCodeStart":272,"sourceCodeEnd":308,"githubUrl":"https://github.com/plandex-ai/plandex/blob/e2d772072efadbe41d2946d97d79be55532dbab5/app/server/model/plan/tell_exec.go#L272-L308","documentation":"execTellPlan builds the system prompt via state.getTellSysPrompt(getTellSysPromptParams). On failure the error is logged, reported, and pushed to StreamDoneCh as a 500 ApiError \"Error getting tell sys prompt: %v\". The tell run aborts because the system prompt — which includes context maps and instructions — could not be constructed.","triggerScenarios":"getTellSysPrompt returns an error for the given TellSysPromptParams during execTellPlan: failures building the context map (unreadable files in plan context), errors rendering prompt templates, or downstream context/token estimation errors while assembling prompt parts.","commonSituations":"Files in the plan context were deleted or made unreadable on disk after being loaded; template/rule files with invalid syntax; context map generation failing on binary or undecodable files; DB errors fetching context entries.","solutions":["Read the wrapped error in the message/logs — it names the failing prompt component (context map, template, file read).","Verify all files in the plan context still exist and are readable on disk; remove/re-add missing ones.","Check custom rules/instruction files for syntax problems and fix or remove them.","Retry the tell request after repairing the context state."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// ensure every context file is readable before telling\nfor path := range plan.ContextMap() {\n    f, err := os.Open(path)\n    if err != nil {\n        return fmt.Errorf(\"unreadable context file %s: %w\", path, err)\n    }\n    f.Close()\n}","typeGuard":null,"tryCatchPattern":"apiErr := <-active.StreamDoneCh\nif strings.HasPrefix(apiErr.Msg, \"Error getting tell sys prompt\") {\n    cause := strings.TrimPrefix(apiErr.Msg, \"Error getting tell sys prompt: \")\n    log.Printf(\"sys prompt build failed: %s\", cause)\n    // fix the named component (missing file/template) then retry\n    return retryTell(planId, branch)\n}","preventionTips":["Keep context files on disk and readable for the plan's lifetime.","Lint custom rules/instruction templates for syntax errors.","Exclude binary/undecodable files from context if prompt generation chokes on them.","Re-add context entries after any external file moves or deletions."],"tags":["go","prompt","context-map","llm"],"backgroundTag":"prompt-build-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"}