{"record":{"id":"de1516241c68dc7f","repo":"shareAI-lab/learn-claude-code","slug":"unknown-workflow-name","errorCode":null,"errorMessage":"unknown workflow '{name}'","messagePattern":"unknown workflow '(.+?)'","errorType":"validation","errorClass":"WorkflowInputError","httpStatus":null,"severity":"error","filePath":"s16_workflow_runtime/code.py","lineNumber":527,"sourceCode":"\n    async def pipeline(self, items, *stages):\n        \"\"\"Per-item staged flow, NO barrier between stages: item A can be in\n        stage 3 while item B is still in stage 1. Each stage gets\n        (prev_result, original_item, index). A throwing stage fails the workflow.\"\"\"\n        async def run_item(item, idx):\n            value = item\n            for stage in stages:\n                value = await stage(value, item, idx)\n            return value\n        return await asyncio.gather(*[run_item(it, i) for i, it in enumerate(items)])\n\n    async def workflow(self, name, args=None):\n        \"\"\"Run a saved workflow inline as a child (one level), sharing this run's\n        journal + budget + agent counter.\"\"\"\n        if self._depth >= 1:\n            raise WorkflowInputError(\"workflow() nesting is one level only\")\n        if name not in WORKFLOWS:\n            raise WorkflowInputError(f\"unknown workflow '{name}'\")\n        meta, fn = WORKFLOWS[name]\n        child = ExecutionState(self.task, self.journal, self.runner, self.budget,\n                               args or {}, depth=self._depth + 1,\n                               limits=self._limits)\n        return await fn(child, args or {})\n\n\n# -- Workflow Tool --\nclass WorkflowTool:\n    \"\"\"The Workflow tool. .call() validates meta, runs the permission check,\n    creates runId/taskId, registers a LocalWorkflowTask, and emits lifecycle\n    events while executing the script. It returns the result and task state and\n    supports resume.\"\"\"\n\n    async def call(self, meta, script_fn, args=None, resume_from_run_id=None):\n        validate_meta(meta)\n        check_permission(meta)\n        resuming = resume_from_run_id is not None","sourceCodeStart":509,"sourceCodeEnd":545,"githubUrl":"https://github.com/shareAI-lab/learn-claude-code/blob/985456f4adea6f4df8fbad4112245dbd97444eae/s16_workflow_runtime/code.py#L509-L545","documentation":"ExecutionState.workflow() looks the requested name up in the module-level WORKFLOWS registry of saved workflows; an unknown name raises WorkflowInputError(\"unknown workflow '{name}'\"). Only names explicitly registered in WORKFLOWS (host-trusted code) can run — this is the trust boundary the docstring 'resolve trusted code from the host registry' refers to.","triggerScenarios":"Calling ctx.workflow(name) from inside a running workflow where name is not a key in WORKFLOWS — typo, unregistered workflow, or a name that exists only in a different deployment.","commonSituations":"Renaming a workflow without updating call sites; expecting dynamically defined workflows to be runnable; running against a registry built from an older version of the module.","solutions":["Check WORKFLOWS.keys() (or the tool's workflow listing) and use the exact registered name.","If the workflow should exist, register it in WORKFLOWS with its meta and script function before calling.","Fix casing/typo: names are matched exactly and must satisfy the workflow-name pattern."],"exampleFix":"# before\nawait ctx.workflow(\"code-review\")  # registry has \"review\"\n\n# after\nawait ctx.workflow(\"review\")","handlingStrategy":"type-guard","validationCode":"from s16_workflow_runtime import WORKFLOWS\nif name not in WORKFLOWS:\n    raise KeyError(f\"available: {sorted(WORKFLOWS)}\")\nawait ctx.workflow(name, args)","typeGuard":"def is_registered_workflow(name) -> bool:\n    return isinstance(name, str) and name in WORKFLOWS","tryCatchPattern":"try:\n    await ctx.workflow(name, args)\nexcept WorkflowInputError as e:\n    if \"unknown workflow\" in str(e):\n        pick = match_closest(name, WORKFLOWS.keys())  # suggest nearest\n        raise ValueError(f\"did you mean {pick}?\") from e\n    raise","preventionTips":["Expose the registry listing to callers so names are discovered, not guessed.","Centralize workflow names as constants shared between registrar and call sites.","Validate names against WORKFLOWS before launching long-running runs."],"tags":["workflow","registry","lookup","validation"],"backgroundTag":null,"analyzedSha":"985456f4adea6f4df8fbad4112245dbd97444eae","analyzedAt":"2026-08-14T22:02:26.028Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}