{"record":{"id":"d5469f677330eb59","repo":"micro/go-micro","slug":"agent-run-s-is-not-waiting-for-human-input","errorCode":null,"errorMessage":"agent run %s is not waiting for human input","messagePattern":"agent run (.+?) is not waiting for human input","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agent/checkpoint.go","lineNumber":139,"sourceCode":"\tif !ok {\n\t\treturn nil, fmt.Errorf(\"agent resume input: unsupported agent implementation %T\", ag)\n\t}\n\treturn a.resumeInput(ctx, runID, input)\n}\n\nfunc (a *agentImpl) resumeInput(ctx context.Context, runID, input string) (*Response, error) {\n\tif a.opts.Checkpoint == nil {\n\t\treturn nil, fmt.Errorf(\"agent %s has no checkpoint configured\", a.opts.Name)\n\t}\n\trun, ok, err := a.opts.Checkpoint.Load(ctx, runID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"agent run %s not found\", runID)\n\t}\n\tif run.Status != \"paused\" || run.State.Stage != agentInputStep {\n\t\treturn nil, fmt.Errorf(\"agent run %s is not waiting for human input\", runID)\n\t}\n\tvar p inputPause\n\tif err := run.State.Scan(&p); err != nil {\n\t\treturn nil, fmt.Errorf(\"agent run %s input state decode: %w\", runID, err)\n\t}\n\tmessage := p.OriginalMessage\n\tif message == \"\" {\n\t\tmessage = string(run.State.Data)\n\t}\n\tmessage += \"\\n\\nHuman input: \" + input\n\trun.Status = \"running\"\n\trun.State.Stage = agentAskStep\n\trun.State.Data = []byte(message)\n\ta.mu.Lock()\n\tdefer a.mu.Unlock()\n\tif a.model == nil {\n\t\ta.setup()\n\t}","sourceCodeStart":121,"sourceCodeEnd":157,"githubUrl":"https://github.com/micro/go-micro/blob/24529f140421a11a33b6999ab7944f2021cfd69c/agent/checkpoint.go#L121-L157","documentation":"agent.ResumeInput requires the checkpointed run to be paused specifically at the \"input-required\" stage (Status==\"paused\" && State.Stage==agentInputStep). Any other state — running, done, approval-paused, failed — is rejected because supplying human input is meaningless or unsafe there.","triggerScenarios":"Calling ResumeInput on a run that is still running, already done, failed, or paused for approval rather than for input; double-calling ResumeInput after the first call flipped the run to \"running\".","commonSituations":"Race conditions where two workers answer the same input prompt concurrently; generic resume handlers that always call ResumeInput; retrying ResumeInput after a transient error when the run already advanced.","solutions":["Check the run's status and stage via the checkpoint store before calling ResumeInput and route to Resume/other handling as appropriate.","Make input answering idempotent/single-shot: mark the prompt as answered in your own system before invoking ResumeInput.","Use Resume for approval-paused runs; only the request_input tool flow needs ResumeInput.","Handle the error as a benign race in concurrent workers and let one caller proceed."],"exampleFix":"// before\nagent.ResumeInput(ctx, ag, runID, input) // run already running after first call\n// after\nrun, ok, _ := ckpt.Load(ctx, runID)\nif ok && run.Status == \"paused\" && run.State.Stage == \"input-required\" {\n    _, err = agent.ResumeInput(ctx, ag, runID, input)\n}","handlingStrategy":"validation","validationCode":"run, ok, _ := ckpt.Load(ctx, runID)\nif !ok || run.Status != \"paused\" || run.State.Stage != \"input-required\" {\n    return fmt.Errorf(\"run %s not awaiting input (status=%s stage=%s)\", runID, run.Status, run.State.Stage)\n}","typeGuard":"func awaitingInput(r flow.Run) bool {\n    return r.Status == \"paused\" && r.State.Stage == \"input-required\"\n}","tryCatchPattern":"_, err := agent.ResumeInput(ctx, ag, runID, input)\nif err != nil && strings.Contains(err.Error(), \"not waiting for human input\") {\n    // another worker already answered; treat as success/no-op\n}","preventionTips":["Answer each input prompt exactly once; use a claim/lock in your orchestration.","Check status+stage before ResumeInput.","Route approval pauses to Resume, input pauses to ResumeInput."],"tags":["agent","checkpoint","state-mismatch","human-input"],"backgroundTag":"invalid-state-transition","analyzedSha":"24529f140421a11a33b6999ab7944f2021cfd69c","analyzedAt":"2026-09-01T02:52:24.923Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}