plandex-ai/plandex · error

No namePlan function call found in response. The model faile

Error message

No namePlan function call found in response. The model failed to generate a valid response.

What it means

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.

Source

Thrown at app/server/model/name.go:100

	})

	if err != nil {
		fmt.Printf("Error during plan name model call: %v\n", err)
		return "", err
	}

	var planName string
	content := modelRes.Content

	if baseModelConfig.PreferredOutputFormat == shared.ModelOutputFormatXml {
		planName = utils.GetXMLContent(content, "planName")
		if planName == "" {
			return "", fmt.Errorf("No planName tag found in XML response")
		}
	} else {
		if content == "" {
			fmt.Println("no namePlan function call found in response")
			return "", fmt.Errorf("No namePlan function call found in response. The model failed to generate a valid response.")
		}

		var nameRes prompts.PlanNameRes
		err = json.Unmarshal([]byte(content), &nameRes)
		if err != nil {
			fmt.Printf("Error unmarshalling plan description response: %v\n", err)
			return "", err
		}
		planName = nameRes.PlanName
	}

	return planName, nil
}

type GenPipedDataNameParams struct {
	Ctx           context.Context
	Auth          *types.ServerAuth
	Plan          *db.Plan

View on GitHub (pinned to e2d772072e)

Solutions

  1. Retry the generation once; LLM tool-call failures are often transient nondeterminism.
  2. Verify the request passes tools/tool_choice correctly so namePlan is the forced function.
  3. Check that PreferredOutputFormat matches the prompt/response parsing path (XML vs function-call/JSON).
  4. Switch to a model with stronger function-calling support or lower temperature.
  5. Increase max_tokens / shorten the prompt so the response is not truncated before the call.

Example fix

// before: model may answer in prose
req := modelReq{Prompt: prompt}
// after: force the function call
req := modelReq{Prompt: prompt, Tools: namePlanTool, ToolChoice: {Type: "function", Function: {Name: "namePlan"}}}
Defensive patterns

Strategy: try-catch

Type guard

func hasContent(res *shared.ModelRes) bool { return res != nil && res.Content != "" }

Try / catch

name, err := model.GenPlanName(ctx, req)
if err != nil {
    if strings.Contains(err.Error(), "No namePlan function call found") {
        name, err = model.GenPlanName(ctx, req) // one retry
    }
    if err != nil { return fmt.Errorf("plan naming failed: %w", err) }
}

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Related errors


AI-assisted analysis of plandex-ai/plandex@e2d772072e (2026-09-05). Data as JSON: /api/errors/9a5cf92872c791ac. Report an issue: GitHub.