plandex-ai/plandex · error
no whole file found in response
Error message
no whole file found in response
What it means
After a successful model call, the response must contain a <PlandexWholeFile> element extracted via utils.GetXMLContent. If the content has no such tag, the empty result is treated as a failure and routed to wholeFileRetryOrError with this error.
Source
Thrown at app/server/model/plan/build_whole_file.go:137
log.Printf("buildWholeFileFallback - context canceled during model request for file %s", filePath)
return "", err
}
return "", fmt.Errorf("error calling model: %v", err)
}
fileState.builderRun.GenerationIds = append(fileState.builderRun.GenerationIds, modelRes.GenerationId)
fileState.builderRun.BuildWholeFileFinishedAt = time.Now()
content := modelRes.Content
// log.Printf("buildWholeFile - %s - content:\n%s\n", filePath, content)
wholeFile := utils.GetXMLContent(content, "PlandexWholeFile")
if wholeFile == "" {
log.Printf("buildWholeFile - no whole file found in response\n")
return fileState.wholeFileRetryOrError(buildCtx, proposedContent, desc, comments, sessionId, fmt.Errorf("no whole file found in response"))
}
return wholeFile, nil
}
func (fileState *activeBuildStreamFileState) wholeFileRetryOrError(buildCtx context.Context, proposedContent string, desc string, comments string, sessionId string, err error) (string, error) {
if fileState.wholeFileNumRetry < MaxBuildErrorRetries {
fileState.wholeFileNumRetry++
log.Printf("buildWholeFile - retrying whole file file '%s' due to error: %v\n", fileState.filePath, err)
activePlan := GetActivePlan(fileState.plan.Id, fileState.branch)
if activePlan == nil {
log.Printf("buildWholeFile - active plan not found for plan ID %s and branch %s\n", fileState.plan.Id, fileState.branch)
// fileState.onBuildFileError(fmt.Errorf("active plan not found for plan ID %s and branch %s", fileState.plan.Id, fileState.branch))
return "", fmt.Errorf("active plan not found for plan ID %s and branch %s", fileState.plan.Id, fileState.branch)
}View on GitHub (pinned to e2d772072e)
Solutions
- Retry — wholeFileRetryOrError will re-prompt the model for correctly wrapped output
- Strengthen the prompt/ few-shot examples enforcing the PlandexWholeFile tag
- Increase max tokens if truncation drops the closing tag
Example fix
// before response = "Here is the file: ..." // no XML tag // after response = "<PlandexWholeFile>package main ...</PlandexWholeFile>"
Defensive patterns
Strategy: fallback
Validate before calling
if wholeFile := utils.GetXMLContent(content, "PlandexWholeFile"); wholeFile == "" {
return retryWithFormatReminder(ctx) // re-prompt emphasizing the XML wrapper
} Type guard
func hasWholeFileTag(content string) bool {
return strings.Contains(content, "<PlandexWholeFile>") && strings.Contains(content, "</PlandexWholeFile>")
} Try / catch
wholeFile, err := buildWholeFileFallback(...)
if err != nil && err.Error() == "no whole file found in response" {
// fall back to a retry prompt or a different builder strategy
} Prevention
- Keep format instructions and examples strong in the prompt
- Increase max tokens to prevent truncated XML
- Consider lenient extraction (regex over partial tags) before failing
When it happens
Trigger: Model returns prose, code without the required PlandexWholeFile XML wrapper, or truncated output missing the closing tag.
Common situations: Smaller/weaker models ignoring the XML format, responses cut off by token limits, or prompt drift that weakens the format instructions.
Related errors
- No planName tag found in XML response
- old content does not have a line number prefix for first lin
- error extracting line number from first line: %v
- error extracting line number from last line: %v
- invalid line number for first line: %d
AI-assisted analysis of plandex-ai/plandex@e2d772072e (2026-09-05).
Data as JSON: /api/errors/275313bd4f593043.
Report an issue: GitHub.