{"record":{"id":"9a5cf92872c791ac","repo":"plandex-ai/plandex","slug":"no-nameplan-function-call-found-in-response-the-m","errorCode":null,"errorMessage":"No namePlan function call found in response. The model failed to generate a valid response.","messagePattern":"No namePlan function call found in response\\. The model failed to generate a valid response\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"app/server/model/name.go","lineNumber":100,"sourceCode":"\t})\n\n\tif err != nil {\n\t\tfmt.Printf(\"Error during plan name model call: %v\\n\", err)\n\t\treturn \"\", err\n\t}\n\n\tvar planName string\n\tcontent := modelRes.Content\n\n\tif baseModelConfig.PreferredOutputFormat == shared.ModelOutputFormatXml {\n\t\tplanName = utils.GetXMLContent(content, \"planName\")\n\t\tif planName == \"\" {\n\t\t\treturn \"\", fmt.Errorf(\"No planName tag found in XML response\")\n\t\t}\n\t} else {\n\t\tif content == \"\" {\n\t\t\tfmt.Println(\"no namePlan function call found in response\")\n\t\t\treturn \"\", fmt.Errorf(\"No namePlan function call found in response. The model failed to generate a valid response.\")\n\t\t}\n\n\t\tvar nameRes prompts.PlanNameRes\n\t\terr = json.Unmarshal([]byte(content), &nameRes)\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"Error unmarshalling plan description response: %v\\n\", err)\n\t\t\treturn \"\", err\n\t\t}\n\t\tplanName = nameRes.PlanName\n\t}\n\n\treturn planName, nil\n}\n\ntype GenPipedDataNameParams struct {\n\tCtx           context.Context\n\tAuth          *types.ServerAuth\n\tPlan          *db.Plan","sourceCodeStart":82,"sourceCodeEnd":118,"githubUrl":"https://github.com/plandex-ai/plandex/blob/e2d772072efadbe41d2946d97d79be55532dbab5/app/server/model/name.go#L82-L118","documentation":"GenPlanName asks the LLM to generate a plan name via a tool/function call named namePlan. When the model response contains no function call, `content` is empty and the function returns this error instead of a name. It means the model failed to follow the expected tool-calling contract, so no usable name payload was produced.","triggerScenarios":"Calling GenPlanName when the LLM reply has no namePlan function call: model returns a plain-text answer, refuses, hits a safety filter, or the provider drops tool_call fields (e.g. wrong tool_choice / tools config, or output format mismatch).","commonSituations":"Model names that weakly support function calling, prompts that accidentally instruct the model to answer in prose, provider API version changes that alter tool_call response shape, or max_tokens too low so the call is truncated.","solutions":["Retry the generation once; LLM tool-call failures are often transient nondeterminism.","Verify the request passes tools/tool_choice correctly so namePlan is the forced function.","Check that PreferredOutputFormat matches the prompt/response parsing path (XML vs function-call/JSON).","Switch to a model with stronger function-calling support or lower temperature.","Increase max_tokens / shorten the prompt so the response is not truncated before the call."],"exampleFix":"// before: model may answer in prose\nreq := modelReq{Prompt: prompt}\n// after: force the function call\nreq := modelReq{Prompt: prompt, Tools: namePlanTool, ToolChoice: {Type: \"function\", Function: {Name: \"namePlan\"}}}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":"func hasContent(res *shared.ModelRes) bool { return res != nil && res.Content != \"\" }","tryCatchPattern":"name, err := model.GenPlanName(ctx, req)\nif err != nil {\n    if strings.Contains(err.Error(), \"No namePlan function call found\") {\n        name, err = model.GenPlanName(ctx, req) // one retry\n    }\n    if err != nil { return fmt.Errorf(\"plan naming failed: %w\", err) }\n}","preventionTips":["Force tool_choice to the namePlan function in every naming request","Keep prompt format instructions consistent with PreferredOutputFormat","Set generous max_tokens so the tool call is never truncated","Prefer models with proven function-calling reliability"],"tags":["llm","function-calling","model-response"],"backgroundTag":"llm-empty-tool-call-response","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"}