{"record":{"id":"d5086ca1f99ef6a9","repo":"plandex-ai/plandex","slug":"fast-apply-validation-failed-s","errorCode":null,"errorMessage":"fast apply validation failed: %s","messagePattern":"fast apply validation failed: (.+?)","errorType":"http","errorClass":null,"httpStatus":500,"severity":"warning","filePath":"app/server/model/plan/build_race.go","lineNumber":196,"sourceCode":"\t\t\t\tif errors.Is(err, context.Canceled) {\n\t\t\t\t\tlog.Printf(\"Context canceled during fast apply validation\")\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tlog.Printf(\"buildRace - fast apply validation failed with error: %v\", err)\n\t\t\t\tsendErr(fmt.Errorf(\"fast apply validation failed: %w\", err))\n\t\t\t\tonFail()\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif validateResult.valid {\n\t\t\t\tlog.Printf(\"buildRace - fast apply validation succeeded\")\n\t\t\t\tfileState.builderRun.FastApplySuccess = true\n\t\t\t\tsendRes(raceResult{content: validateResult.updated, valid: validateResult.valid})\n\t\t\t} else {\n\t\t\t\tlog.Printf(\"buildRace - fast apply validation failed with problem: %s\", validateResult.problem)\n\t\t\t\tfileState.builderRun.FastApplyFailureResponse = validateResult.problem\n\t\t\t\tsendErr(fmt.Errorf(\"fast apply validation failed: %s\", validateResult.problem))\n\t\t\t\tonFail()\n\t\t\t\treturn\n\t\t\t}\n\t\t}()\n\t}\n\n\tstartFallbacks := func(comments string) {\n\t\tstartedFallbacks = true\n\t\t// try fast apply + validation first if it's defined\n\t\t// if it's undefined or fails, start the whole file build fallback\n\t\tmaybeStartFastApply(func() {\n\t\t\tstartWholeFileBuild(comments)\n\t\t})\n\t}\n\n\t// If we get an incorrect marker, start the whole file build in the background while the validation/replacement loop continues\n\tonInitialStream := func(chunk string, buffer string) bool {\n\t\tif !startedFallbacks && strings.Contains(buffer, \"<PlandexIncorrect/>\") && strings.Contains(buffer, \"<PlandexComments>\") {","sourceCodeStart":178,"sourceCodeEnd":214,"githubUrl":"https://github.com/plandex-ai/plandex/blob/e2d772072efadbe41d2946d97d79be55532dbab5/app/server/model/plan/build_race.go#L178-L214","documentation":"The validation loop completed but reported validateResult.valid == false with a human-readable validateResult.problem; the problem text is wrapped into this error and stored in builderRun.FastApplyFailureResponse. It means the fast-apply output was syntactically valid but semantically/structurally rejected by validation, so the race falls back via onFail() to the whole-file build.","triggerScenarios":"buildValidateLoop (maxAttempts:1, validate-only) returns a result whose valid field is false — e.g. the applied edit does not satisfy the requested change, leaves unresolved markers, or fails the model's validation criteria.","commonSituations":"Fast-apply patch applies cleanly but misses part of the requested change; leftover replacement markers in the output; edit context drifted from the original file so the result no longer matches intent; overly aggressive fast-apply on large multi-hunk changes.","solutions":["Read builderRun.FastApplyFailureResponse / validateResult.problem for the rejection reason","Let the built-in fallback proceed — onFail() starts the whole-file rebuild automatically","Reduce fast-apply scope (smaller, targeted edits) so validation is more likely to pass","Improve the fast-apply prompt/constraints so output matches the described change exactly"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if validateResult == nil || (!validateResult.valid && validateResult.problem == \"\") {\n\tlog.Printf(\"validation returned invalid result without a problem description\")\n\tonFail()\n\treturn\n}","typeGuard":"func validationPassed(vr *buildValidateResult) bool {\n\treturn vr != nil && vr.valid\n}","tryCatchPattern":"if !validationPassed(validateResult) {\n\tfileState.builderRun.FastApplyFailureResponse = validateResult.problem\n\tsendErr(fmt.Errorf(\"fast apply validation failed: %s\", validateResult.problem))\n\tonFail()\n\treturn\n}\nsendRes(raceResult{content: validateResult.updated, valid: validateResult.valid})","preventionTips":["Treat valid==false as an expected outcome and always wire onFail() fallback","Persist validateResult.problem (FastApplyFailureResponse) to diagnose recurring rejections","Scope fast-apply edits narrowly so validation criteria are easier to meet","Ensure applied output contains no leftover replacement markers before validating"],"tags":["go","validation","fast-apply","fallback"],"backgroundTag":"validation-rejected","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"}