{"record":{"id":"90ed8c87e51b7890","repo":"micro/go-micro","slug":"run-s-is-not-waiting-for-input-status-q","errorCode":null,"errorMessage":"run %s is not waiting for input (status %q)","messagePattern":"run (.+?) is not waiting for input \\(status %q\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"flow/steps.go","lineNumber":524,"sourceCode":"func (f *Flow) ResumeWith(ctx context.Context, runID, input string) error {\n\tctx, cancel := f.withTimeout(ctx)\n\tdefer cancel()\n\n\tif err := validateSteps(f.opts.Steps); err != nil {\n\t\treturn err\n\t}\n\tif f.checkpoint == nil {\n\t\treturn fmt.Errorf(\"flow %s has no checkpoint configured\", f.name)\n\t}\n\trun, ok, err := f.checkpoint.Load(ctx, runID)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif !ok {\n\t\treturn fmt.Errorf(\"run %s not found\", runID)\n\t}\n\tif run.Status != \"waiting\" {\n\t\treturn fmt.Errorf(\"run %s is not waiting for input (status %q)\", runID, run.Status)\n\t}\n\tsteps := f.opts.Steps\n\ti := stepIndex(steps, run.State.Stage)\n\tif i < 0 {\n\t\treturn fmt.Errorf(\"run %s is waiting at unknown step %q\", runID, run.State.Stage)\n\t}\n\t// The awaited step is satisfied by the injected input; record it done and\n\t// advance so runFrom re-enters at the next step.\n\trun.Steps[i].Status = \"done\"\n\trun.Steps[i].Result = truncate(input, 200)\n\trun.State.Data = []byte(input)\n\tif i+1 < len(steps) {\n\t\trun.State.Stage = steps[i+1].Name\n\t} else {\n\t\trun.State.Stage = \"\"\n\t}\n\trun.Await = nil\n\trun.Status = \"running\"","sourceCodeStart":506,"sourceCodeEnd":542,"githubUrl":"https://github.com/micro/go-micro/blob/24529f140421a11a33b6999ab7944f2021cfd69c/flow/steps.go#L506-L542","documentation":"After loading a waiting run, ResumeWith looks up the run's current stage (run.State.Stage) in the flow's configured steps via stepIndex. A waiting run whose stage doesn't match any configured step cannot be resumed safely, so the library returns this error. It typically means the flow definition changed since the run was persisted.","triggerScenarios":"Calling ResumeWith on a run whose persisted State.Stage names a step that no longer exists in f.opts.Steps — e.g. the step was renamed, removed, or the run was saved by a differently configured flow with the same checkpoint.","commonSituations":"Deploying a new version of the flow (renamed/deleted a step) while old runs were waiting in the checkpoint store; resuming a run with a Flow instance whose Steps option differs from the one that created it; running multiple flow variants that share a checkpoint store.","solutions":["Restore the original step name in the flow definition so the persisted stage matches a configured step.","Migrate old waiting runs: either let them fail out, or manually update run.State.Stage in the checkpoint store to a valid step name.","Use flow versioning (separate flow names or separate checkpoint keys per version) so old runs resume against their matching definition.","Before deploy, drain waiting runs (call ResumeWith for each) so no runs persist across the step-rename."],"exampleFix":"// before (deployed rename)\nflow.Steps(flow.Step{Name: \"approve-v2\", Run: approve}) // old runs wait at \"approve\"\n\n// after (keep old name or add alias step)\nflow.Steps(flow.Step{Name: \"approve\", Run: approve})","handlingStrategy":"validation","validationCode":"run, _, _ := ckpt.Load(ctx, runID)\ni := stepIndex(f.opts.Steps, run.State.Stage)\nif i < 0 {\n    return fmt.Errorf(\"waiting run %s references unknown step %q; flow definition changed\", runID, run.State.Stage)\n}","typeGuard":"func stepStillConfigured(steps []flow.Step, stage string) bool {\n    return stepIndex(steps, stage) >= 0\n}","tryCatchPattern":"if _, err := f.ResumeWith(ctx, runID, input); err != nil {\n    if strings.Contains(err.Error(), \"unknown step\") {\n        // migrate/expire the stale run; do not retry blindly\n        return expireRun(ctx, runID)\n    }\n    return err\n}","preventionTips":["Never rename or delete flow steps while runs may be waiting in the checkpoint","Version flows (new name per schema version) so old runs resume with their own definition","Before deploy, drain waiting runs via ResumePending","Alert on 'unknown step' errors — they indicate deploy/run state drift"],"tags":["go","flow","resume","schema-drift"],"backgroundTag":"checkpoint-state-drift","analyzedSha":"24529f140421a11a33b6999ab7944f2021cfd69c","analyzedAt":"2026-09-01T02:52:24.923Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}