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

  1. Retry — wholeFileRetryOrError will re-prompt the model for correctly wrapped output
  2. Strengthen the prompt/ few-shot examples enforcing the PlandexWholeFile tag
  3. 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

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


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