{"record":{"id":"1617d0c8e621beec","repo":"plandex-ai/plandex","slug":"fast-apply-validation-failed-w","errorCode":null,"errorMessage":"fast apply validation failed: %w","messagePattern":"fast apply validation failed: %w","errorType":"http","errorClass":null,"httpStatus":500,"severity":"error","filePath":"app/server/model/plan/build_race.go","lineNumber":184,"sourceCode":"\t\t\t\tproposedContent: proposedContent,\n\t\t\t\tdesc:            desc,\n\t\t\t\treasons:         reasons,\n\n\t\t\t\t// just validate since we're already building replacements in parallel\n\t\t\t\tmaxAttempts:                1,\n\t\t\t\tvalidateOnlyOnFinalAttempt: true,\n\t\t\t\tisInitial:                  false,\n\t\t\t\tsessionId:                  sessionId,\n\t\t\t})\n\n\t\t\tif err != nil {\n\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","sourceCodeStart":166,"sourceCodeEnd":202,"githubUrl":"https://github.com/plandex-ai/plandex/blob/e2d772072efadbe41d2946d97d79be55532dbab5/app/server/model/plan/build_race.go#L166-L202","documentation":"The single-attempt buildValidateLoop run on the fast-apply output returned a non-nil, non-cancellation error. It is wrapped with %w so the underlying cause (typically an LLM API failure inside the validation loop) is preserved. This differs from error 679, which is a validation 'problem' result rather than a hard error.","triggerScenarios":"After fast apply passes syntax checks, fileState.buildValidateLoop is called with maxAttempts:1 and returns an error that is not context.Canceled — e.g. the validation LLM call fails, times out, or an internal assertion fires.","commonSituations":"LLM provider outages/rate limits during validation; context deadline from an ancestor context (not plain context.Canceled, so it isn't filtered); nil state in the validate loop when invoked from the fast-apply goroutine.","solutions":["Check the wrapped cause with errors.Is/As on the returned error and the preceding log line 'fast apply validation failed with error'","Verify LLM provider health/credentials used by the validate loop","Ensure cancellation is detected with errors.Is(err, context.Canceled) so user cancels don't surface as failures","Retry the build; onFail() already starts the whole-file fallback"],"exampleFix":"// before\nif errors.Is(err, context.Canceled) { return }\nsendErr(fmt.Errorf(\"fast apply validation failed: %w\", err))\n// after\nif errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded) {\n\tlog.Printf(\"validation canceled/expired, skipping\")\n\treturn\n}\nsendErr(fmt.Errorf(\"fast apply validation failed: %w\", err))","handlingStrategy":"try-catch","validationCode":"// validate preconditions before running the validation loop\nif buildCtx.Err() != nil { return buildCtx.Err() }\nif fastApplyRes == \"\" { return fmt.Errorf(\"empty fast apply result\") }","typeGuard":"func isCancellation(err error) bool {\n\treturn errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded)\n}","tryCatchPattern":"validateResult, err := fileState.buildValidateLoop(buildCtx, params)\nif err != nil {\n\tif isCancellation(err) {\n\t\treturn // cancellation is not a validation failure\n\t}\n\tsendErr(fmt.Errorf(\"fast apply validation failed: %w\", err))\n\tonFail()\n\treturn\n}","preventionTips":["Filter cancellations with errors.Is before reporting validation failures","Keep LLM credentials/limits healthy; validate-loop calls are API-bound","Retry transient provider errors upstream of the race","Remember maxAttempts:1 means no internal retries — add external retry if needed"],"tags":["go","llm","validation","error-wrapping"],"backgroundTag":"llm-request-failed","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"}