{"record":{"id":"c735d462f1fe6915","repo":"micro/go-micro","slug":"flow-verify-requires-a-grader","errorCode":null,"errorMessage":"flow: Verify requires a grader","messagePattern":"flow: Verify requires a grader","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"flow/verify.go","lineNumber":72,"sourceCode":"// \"verification_passed\": false, \"verification_feedback\", and\n// \"verification_attempts\".\nfunc Verify(body StepFunc, grader Grader, opts ...VerifyOption) StepFunc {\n\to := VerifyOptions{MaxAttempts: 2, FeedbackField: \"feedback\"}\n\tfor _, op := range opts {\n\t\top(&o)\n\t}\n\tif o.MaxAttempts <= 0 {\n\t\to.MaxAttempts = 2\n\t}\n\tif o.FeedbackField == \"\" {\n\t\to.FeedbackField = \"feedback\"\n\t}\n\treturn func(ctx context.Context, in State) (State, error) {\n\t\tif body == nil {\n\t\t\treturn in, fmt.Errorf(\"flow: Verify requires a body step\")\n\t\t}\n\t\tif grader == nil {\n\t\t\treturn in, fmt.Errorf(\"flow: Verify requires a grader\")\n\t\t}\n\t\tcur := in\n\t\tlast := in\n\t\tfeedback := \"\"\n\t\tfor attempt := 1; attempt <= o.MaxAttempts; attempt++ {\n\t\t\tif err := ctx.Err(); err != nil {\n\t\t\t\treturn last, err\n\t\t\t}\n\t\t\tif feedback != \"\" {\n\t\t\t\tvar err error\n\t\t\t\tcur, err = stateWithField(cur, o.FeedbackField, feedback)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn last, err\n\t\t\t\t}\n\t\t\t}\n\t\t\tout, err := body(ctx, cur)\n\t\t\tif err != nil {\n\t\t\t\treturn last, fmt.Errorf(\"verify attempt %d: %w\", attempt, err)","sourceCodeStart":54,"sourceCodeEnd":90,"githubUrl":"https://github.com/micro/go-micro/blob/24529f140421a11a33b6999ab7944f2021cfd69c/flow/verify.go#L54-L90","documentation":"flow.Verify requires both a body step and a grader; this error is returned at run time when the grader function is nil. Without a grader the verification loop cannot decide pass/fail, so the input State is returned unchanged with this error. Like the missing-body error, it signals a misconfigured Verify call.","triggerScenarios":"Calling flow.Verify(body, nil), or passing a grader variable that was never assigned (e.g. LLMGrader(...) result discarded or a conditional that skipped assignment).","commonSituations":"Choosing a grader from config where no grader type was specified; a stub returning nil during development; renaming a grader variable and leaving the Verify call pointing at a nil zero-value.","solutions":["Pass a non-nil Grader (e.g. flow.LLMGrader(rubric) or a custom func) as the second argument to Verify.","Ensure the flow model is configured if using LLMGrader, since a nil grader and a failing grader setup are common confusions.","Validate grader != nil before constructing the flow to surface the problem at build time."],"exampleFix":"// before\nreturn flow.Verify(body, nil)\n// after\ngrader := flow.LLMGrader(\"output must contain a summary\")\nreturn flow.Verify(body, grader)","handlingStrategy":"validation","validationCode":"if grader == nil {\n    return nil, errors.New(\"verify: grader must be configured\")\n}\nreturn flow.Verify(body, grader), nil","typeGuard":"func graderConfigured(g flow.Grader) bool { return g != nil }","tryCatchPattern":"out, err := verifiedStep(ctx, in)\nif err != nil && strings.Contains(err.Error(), \"Verify requires a grader\") {\n    // misconfiguration: supply a grader before re-running\n}","preventionTips":["Default to flow.LLMGrader(rubric) with a sensible rubric when no grader is specified.","Resolve graders from config with a fallback and log when a fallback is used.","Test each Verify wiring at least once end-to-end."],"tags":["go","flow","verify","grader","nil-argument"],"backgroundTag":"nil-argument","analyzedSha":"24529f140421a11a33b6999ab7944f2021cfd69c","analyzedAt":"2026-09-01T02:52:24.923Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}