{"record":{"id":"a679ea408f80665f","repo":"agentscope-ai/agentscope","slug":"apple-container-cli-is-not-installed-install-it-f","errorCode":null,"errorMessage":"Apple Container CLI is not installed. Install it first: https://github.com/apple/container","messagePattern":"Apple Container CLI is not installed\\. Install it first: https://github\\.com/apple/container","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"critical","filePath":"src/agentscope/workspace/_applecontainer/_applecontainer_workspace.py","lineNumber":259,"sourceCode":"\n        Raises:\n            RuntimeError: If the CLI is not installed or the system\n                service is not running.\n        \"\"\"\n        try:\n            process = await asyncio.create_subprocess_exec(\n                \"container\",\n                \"system\",\n                \"version\",\n                \"--format\",\n                \"json\",\n                stdout=asyncio.subprocess.PIPE,\n                stderr=asyncio.subprocess.PIPE,\n            )\n            stdout, stderr = await process.communicate()\n        except FileNotFoundError as e:\n            # The ``container`` binary itself is missing.\n            raise RuntimeError(\n                \"Apple Container CLI is not installed. Install it \"\n                \"first: https://github.com/apple/container\",\n            ) from e\n        if process.returncode != 0:\n            raise RuntimeError(\n                \"Apple Container CLI is not available. \"\n                \"Ensure it is installed and running: \"\n                \"`container system start`.\\n\"\n                f\"stderr: {stderr.decode(errors='replace')}\",\n            )\n        logger.info(\n            \"AppleContainerWorkspace: CLI OK — %s\",\n            stdout.decode(errors=\"replace\").strip(),\n        )\n\n    # ── internals: image management ─────────────────────────────\n\n    @staticmethod","sourceCodeStart":241,"sourceCodeEnd":277,"githubUrl":"https://github.com/agentscope-ai/agentscope/blob/e90f1c7592896cc95f6e5ee506194f533378247d/src/agentscope/workspace/_applecontainer/_applecontainer_workspace.py#L241-L277","documentation":"AppleContainerWorkspace._check_cli runs the `container` binary to verify the Apple Container CLI; FileNotFoundError from subprocess means the binary is not on PATH, so the workspace raises RuntimeError with the install URL. Provisioning aborts before any container is created.","triggerScenarios":"Creating an AppleContainerWorkspace on a machine without the apple/container CLI installed (or not on PATH). _check_cli is the first step of _provision_backend, so any constructor/factory call triggers it.","commonSituations":"Running on Linux/CI (the CLI is macOS-only), fresh macOS without the CLI installed, CLI installed via custom location not on PATH, or running from an environment (venv/launchd) with a stripped PATH.","solutions":["Install Apple Container CLI: brew install container (or see https://github.com/apple/container).","Ensure `container` resolves: which container; add its install dir to PATH.","Verify it runs: container system start.","If on non-macOS, use a different workspace backend (e.g. local or docker-based)."],"exampleFix":"# before (fails on Linux/CI)\nws = AppleContainerWorkspace(base_image=\"ubuntu:24.04\")\n\n# after\nimport sys\nif sys.platform == \"darwin\":\n    ws = AppleContainerWorkspace(base_image=\"ubuntu:24.04\")\nelse:\n    ws = LocalWorkspace()  # or another backend","handlingStrategy":"validation","validationCode":"import shutil, sys\nassert sys.platform == \"darwin\" and shutil.which(\"container\"), \"Apple Container CLI required\"","typeGuard":null,"tryCatchPattern":"try:\n    ws = await AppleContainerWorkspace.create(base_image=\"ubuntu:24.04\")\nexcept RuntimeError as e:\n    if \"not installed\" in str(e):\n        ws = LocalWorkspace()  # fallback backend\n    else:\n        raise","preventionTips":["Gate AppleContainerWorkspace usage behind sys.platform == 'darwin'.","Install the CLI via brew and verify with `which container` in CI setup scripts."],"tags":["applecontainer","workspace","cli-missing","installation","macos"],"backgroundTag":"missing-cli-binary","analyzedSha":"e90f1c7592896cc95f6e5ee506194f533378247d","analyzedAt":"2026-08-28T18:24:12.087Z","schemaVersion":2},"datasetVersion":"2026-08-28T21:17:43.275Z"}