{"record":{"id":"ae48e29e33ab856d","repo":"micro/go-micro","slug":"agent-run-s-input-state-decode-w","errorCode":null,"errorMessage":"agent run %s input state decode: %w","messagePattern":"agent run (.+?) input state decode: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agent/checkpoint.go","lineNumber":143,"sourceCode":"}\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}\n\treturn a.askLocked(ctx, run.ID, message, run.ParentID, &run, true)\n}\n\nfunc (a *agentImpl) pending(ctx context.Context) ([]flow.Run, error) {","sourceCodeStart":125,"sourceCodeEnd":161,"githubUrl":"https://github.com/micro/go-micro/blob/24529f140421a11a33b6999ab7944f2021cfd69c/agent/checkpoint.go#L125-L161","documentation":"The paused run's State (an inputPause payload holding the original message) is decoded with run.State.Scan; if that JSON decode fails, resumeInput wraps the error. It indicates the stored input-pause state is corrupt, empty, or written in an incompatible format (e.g. by an older library version).","triggerScenarios":"Checkpoint data for a request_input pause was truncated/corrupted, written by a version whose inputPause schema differs, or the store returned bytes that don't unmarshal into inputPause.","commonSituations":"Library upgrades changing the inputPause struct while old checkpoints remain; manual checkpoint migration/edits; store-level encoding issues (compression, charset) corrupting payloads.","solutions":["Discard the corrupt checkpoint entry and start a new agent run with the original message plus the human input.","Log the wrapped json error to identify the exact field/type mismatch; migrate old records if upgrading versions.","Verify the checkpoint store preserves payloads byte-for-byte (round-trip test).","Fall back to the raw State.Data as the message when OriginalMessage is empty (the library already does this for blank, not malformed, data)."],"exampleFix":"// before\nresp, err := agent.ResumeInput(ctx, ag, runID, input) // corrupt old-format state\n// after\nif err != nil && strings.Contains(err.Error(), \"input state decode\") {\n    ckpt.Delete(ctx, runID)\n    resp, err = ag.Run(ctx, originalMsg + \"\\n\\nHuman input: \" + input)\n}","handlingStrategy":"try-catch","validationCode":"run, ok, _ := ckpt.Load(ctx, runID)\nif ok {\n    var p inputPauseProbe\n    if err := run.State.Scan(&p); err != nil { /* corrupt */ }\n}","typeGuard":null,"tryCatchPattern":"resp, err := agent.ResumeInput(ctx, ag, runID, input)\nif err != nil && strings.Contains(err.Error(), \"input state decode\") {\n    ckpt.Delete(ctx, runID)\n    resp, err = ag.Run(ctx, originalMessage + \"\\n\\nHuman input: \" + input)\n}","preventionTips":["Migrate or drop checkpoints across library version upgrades when the pause payload changes.","Validate store round-trips payloads without corruption.","Avoid manual edits to checkpoint state."],"tags":["agent","checkpoint","json-decode","input-pause"],"backgroundTag":"schema-validation-failed","analyzedSha":"24529f140421a11a33b6999ab7944f2021cfd69c","analyzedAt":"2026-09-01T02:52:24.923Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}