{"record":{"id":"90091fc372b41226","repo":"github/spec-kit","slug":"failed-to-action-label","errorCode":null,"errorMessage":"Failed to {action} {label}.","messagePattern":"Failed to (.+?) (.+?)\\.","errorType":"exception","errorClass":"BundlerError","httpStatus":null,"severity":"error","filePath":"src/specify_cli/bundler/services/primitives.py","lineNumber":139,"sourceCode":"    \"\"\"\n    previous = Path.cwd()\n    os.chdir(path)\n    try:\n        yield\n    finally:\n        os.chdir(previous)\n\n\ndef _delegate_command(action: str, label: str, call) -> None:\n    \"\"\"Run a delegated CLI command callable, translating its exit into errors.\"\"\"\n    import typer\n\n    try:\n        call()\n    except typer.Exit as exc:  # raised by the delegated command on failure\n        code = getattr(exc, \"exit_code\", 0) or 0\n        if code != 0:\n            raise BundlerError(f\"Failed to {action} {label}.\") from exc\n    except SystemExit as exc:  # pragma: no cover - defensive\n        if exc.code not in (0, None):\n            raise BundlerError(f\"Failed to {action} {label}.\") from exc\n\n\nclass _PresetKindManager:\n    def __init__(self, project_root: Path, allow_network: bool) -> None:\n        from ...presets import PresetManager\n\n        self._root = project_root\n        self._allow_network = allow_network\n        self._manager = PresetManager(project_root)\n\n    def is_installed(self, component: ComponentRef) -> bool:\n        try:\n            return self._manager.get_pack(component.id) is not None\n        except Exception:  # noqa: BLE001\n            return False","sourceCodeStart":121,"sourceCodeEnd":157,"githubUrl":"https://github.com/github/spec-kit/blob/bf88c9f9a82fa370c7a7257aa2b3cf10b457b65c/src/specify_cli/bundler/services/primitives.py#L121-L157","documentation":"The bundler delegates component install/remove to existing typer CLI commands (e.g. workflow_add). Those commands signal failure by raising typer.Exit with a non-zero exit_code; _delegate_command translates that into a BundlerError naming the action and label. The underlying command's own error output was already printed to the console.","triggerScenarios":"Installing or removing a workflow/step component through a bundle where the delegated command (workflow_add(component.id), workflow_step_add(component.id), or a remove equivalent) fails — bad id, network failure fetching from the catalog, or a validation failure inside the command.","commonSituations":"A bundle references a workflow/step id that does not exist in the catalog; the catalog is unreachable when the delegated command tries to download; the workflow fails its own install-time checks.","solutions":["Scroll up in the output: the delegated command printed its own error message before typer.Exit — that names the real failure.","Run the delegated command directly to reproduce: `specify workflow add <id>` or `specify workflow step add <id>`.","If the id is wrong, fix it in bundle.yml, validate, rebuild, and reinstall.","If it is a network/catalog failure, fix connectivity or pre-install the component, then re-run the bundle install."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"# Verify the component resolves before bundling it\nfrom specify_cli.workflows.catalog import WorkflowRegistry\n\nregistry = WorkflowRegistry(project_root)\nif not registry.is_installed(workflow_id):\n    # ensure catalog can serve it — the delegated `workflow add` will need it\n    pass","typeGuard":null,"tryCatchPattern":"from specify_cli.bundler.core import BundlerError\n\ntry:\n    install_bundle(project_root, plan, installer)\nexcept BundlerError as exc:\n    if str(exc).startswith(\"Failed to install workflow\") or \"Failed to \" in str(exc):\n        # delegated command already printed its real error above — surface it\n        show_last_command_output()","preventionTips":["Pre-flight delegated ids: `specify workflow add <id>` / `specify workflow step add <id>` once before bundling.","Keep the console output of bundle installs — the root cause is printed by the delegated command, not in the exception.","Validate component ids against the catalog when authoring bundle.yml."],"tags":["bundler","delegation","typer","workflow","install"],"backgroundTag":null,"analyzedSha":"bf88c9f9a82fa370c7a7257aa2b3cf10b457b65c","analyzedAt":"2026-08-14T19:43:37.150Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}