shareAI-lab/learn-claude-code · error · WorkflowInputError

resume runId does not match workflow meta

Error message

resume runId does not match workflow meta

What it means

When WorkflowTool.call() is invoked with resume_from_run_id, _call_locked() reads the persisted snapshot for that runId and verifies snapshot['workflowName'] equals the meta['name'] of the workflow being executed. A mismatch raises WorkflowInputError('resume runId does not match workflow meta'), preventing a runId from being replayed against a different workflow's code and journal keys.

Source

Thrown at s16_workflow_runtime/code.py:559

    async def call(self, meta, script_fn, args=None, resume_from_run_id=None):
        validate_meta(meta)
        check_permission(meta)
        resuming = resume_from_run_id is not None
        if resuming:
            run_id = validate_run_id(resume_from_run_id)
        else:
            run_id = reserve_run_id(meta)
        with workflow_run_lock(run_id):
            return await self._call_locked(
                meta, script_fn, args, run_id, resuming
            )

    async def _call_locked(self, meta, script_fn, args, run_id, resuming):
        if resuming:
            snapshot = _read_snapshot(run_id)
            if snapshot.get("workflowName") != meta["name"]:
                raise WorkflowInputError("resume runId does not match workflow meta")
            saved_args = snapshot.get("args", {})
            if args is None:
                args = saved_args
            elif args != saved_args:
                raise WorkflowInputError("resume args do not match the original run")
            journal = WorkflowJournal(run_id, resume=True)
        else:
            args = args or {}
            journal = WorkflowJournal(run_id, resume=False)
        task_id = create_task_id(run_id)

        task = LocalWorkflowTask(task_id, run_id, meta)
        # Record the launch envelope before workflow execution starts.
        launched = {"status": "async_launched", "taskId": task_id,
                    "taskType": "local_workflow", "runId": run_id,
                    "workflowName": meta["name"]}
        task.event("async_launched", runId=run_id, taskId=task_id)
        task.event("task_started", workflow=meta["name"],

View on GitHub (pinned to 985456f4ad)

Solutions

  1. Resume with the same workflow name that created the run (the runId's wf_<name>_ prefix tells you which).
  2. If the workflow was renamed, resume under its old name or start a fresh run under the new name.
  3. Inspect STORE/<run_id>.json's workflowName field to confirm which workflow owns the snapshot.

Example fix

# before
await run_workflow("security-review", resume_from_run_id="wf_codegen_abc...123")

# after
# runId prefix says the snapshot belongs to "codegen"
await run_workflow("codegen", resume_from_run_id="wf_codegen_abc...123")
Defensive patterns

Strategy: validation

Validate before calling

from s16_workflow_runtime import _read_snapshot, WORKFLOWS
snap = _read_snapshot(run_id)
assert snap["workflowName"] == name, (
    f"runId belongs to {snap['workflowName']}, called with {name}")

Type guard

def run_id_matches(run_id: str, name: str) -> bool:
    # runIds are wf_<name>_<hex>; cheap prefix check before hitting disk
    return run_id.startswith(f"wf_{name}_")

Try / catch

try:
    await run_workflow(name, resume_from_run_id=rid)
except WorkflowInputError as e:
    if "does not match workflow meta" in str(e):
        actual = _read_snapshot(rid)["workflowName"]
        return await run_workflow(actual, resume_from_run_id=rid)
    raise

Prevention

When it happens

Trigger: run_workflow(name='A', resume_from_run_id=<runId originally created for workflow 'B'>), including runIds whose wf_<name>_... prefix names a different workflow.

Common situations: Copy-pasting a runId from logs of another workflow; renaming a workflow after a run was launched; UI passing the last runId regardless of which workflow produced it.

Related errors


AI-assisted analysis of shareAI-lab/learn-claude-code@985456f4ad (2026-08-14). Data as JSON: /api/errors/f7887fef86c1c5ba. Report an issue: GitHub.