{"record":{"id":"275313bd4f593043","repo":"plandex-ai/plandex","slug":"no-whole-file-found-in-response","errorCode":null,"errorMessage":"no whole file found in response","messagePattern":"no whole file found in response","errorType":"http","errorClass":null,"httpStatus":500,"severity":"error","filePath":"app/server/model/plan/build_whole_file.go","lineNumber":137,"sourceCode":"\t\t\tlog.Printf(\"buildWholeFileFallback - context canceled during model request for file %s\", filePath)\n\t\t\treturn \"\", err\n\t\t}\n\n\t\treturn \"\", fmt.Errorf(\"error calling model: %v\", err)\n\t}\n\n\tfileState.builderRun.GenerationIds = append(fileState.builderRun.GenerationIds, modelRes.GenerationId)\n\tfileState.builderRun.BuildWholeFileFinishedAt = time.Now()\n\n\tcontent := modelRes.Content\n\n\t// log.Printf(\"buildWholeFile - %s - content:\\n%s\\n\", filePath, content)\n\n\twholeFile := utils.GetXMLContent(content, \"PlandexWholeFile\")\n\n\tif wholeFile == \"\" {\n\t\tlog.Printf(\"buildWholeFile - no whole file found in response\\n\")\n\t\treturn fileState.wholeFileRetryOrError(buildCtx, proposedContent, desc, comments, sessionId, fmt.Errorf(\"no whole file found in response\"))\n\t}\n\n\treturn wholeFile, nil\n}\n\nfunc (fileState *activeBuildStreamFileState) wholeFileRetryOrError(buildCtx context.Context, proposedContent string, desc string, comments string, sessionId string, err error) (string, error) {\n\tif fileState.wholeFileNumRetry < MaxBuildErrorRetries {\n\t\tfileState.wholeFileNumRetry++\n\n\t\tlog.Printf(\"buildWholeFile - retrying whole file file '%s' due to error: %v\\n\", fileState.filePath, err)\n\n\t\tactivePlan := GetActivePlan(fileState.plan.Id, fileState.branch)\n\n\t\tif activePlan == nil {\n\t\t\tlog.Printf(\"buildWholeFile - active plan not found for plan ID %s and branch %s\\n\", fileState.plan.Id, fileState.branch)\n\t\t\t// fileState.onBuildFileError(fmt.Errorf(\"active plan not found for plan ID %s and branch %s\", fileState.plan.Id, fileState.branch))\n\t\t\treturn \"\", fmt.Errorf(\"active plan not found for plan ID %s and branch %s\", fileState.plan.Id, fileState.branch)\n\t\t}","sourceCodeStart":119,"sourceCodeEnd":155,"githubUrl":"https://github.com/plandex-ai/plandex/blob/e2d772072efadbe41d2946d97d79be55532dbab5/app/server/model/plan/build_whole_file.go#L119-L155","documentation":"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.","triggerScenarios":"Model returns prose, code without the required PlandexWholeFile XML wrapper, or truncated output missing the closing tag.","commonSituations":"Smaller/weaker models ignoring the XML format, responses cut off by token limits, or prompt drift that weakens the format instructions.","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"],"exampleFix":"// before\nresponse = \"Here is the file: ...\"  // no XML tag\n// after\nresponse = \"<PlandexWholeFile>package main ...</PlandexWholeFile>\"","handlingStrategy":"fallback","validationCode":"if wholeFile := utils.GetXMLContent(content, \"PlandexWholeFile\"); wholeFile == \"\" {\n    return retryWithFormatReminder(ctx) // re-prompt emphasizing the XML wrapper\n}","typeGuard":"func hasWholeFileTag(content string) bool {\n    return strings.Contains(content, \"<PlandexWholeFile>\") && strings.Contains(content, \"</PlandexWholeFile>\")\n}","tryCatchPattern":"wholeFile, err := buildWholeFileFallback(...)\nif err != nil && err.Error() == \"no whole file found in response\" {\n    // fall back to a retry prompt or a different builder strategy\n}","preventionTips":["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"],"tags":["go","parsing","llm-output","xml"],"backgroundTag":"missing-xml-tag-in-response","analyzedSha":"e2d772072efadbe41d2946d97d79be55532dbab5","analyzedAt":"2026-09-05T20:56:53.631Z","contentChangedAt":"2026-09-05T20:56:53.631Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}