{"record":{"id":"4a7eaa48165b4976","repo":"agentscope-ai/agentscope","slug":"basedir-must-not-be-empty","errorCode":null,"errorMessage":"basedir must not be empty.","messagePattern":"basedir must not be empty\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/agentscope/app/workspace_manager/_bubblewrap_workspace_manager.py","lineNumber":81,"sourceCode":"                allocate an available loopback port during initialization.\n            share_net (`bool`, defaults to `True`):\n                Must be ``True`` for the current Bubblewrap workspace TCP\n                gateway design.\n            env (`dict[str, str] | None`, optional):\n                Extra environment variables for every workspace.\n            extra_pip (`list[str] | None`, optional):\n                Extra gateway venv requirements.\n            default_mcps (`list[MCPClient] | None`, optional):\n                MCPs seeded into new workspaces.\n            skill_paths (`list[str] | None`, optional):\n                Skill dirs seeded into new workspaces.\n            ttl (`float`, defaults to `3600.0`):\n                Seconds before an idle workspace is evicted.\n            sweep_interval (`float`, defaults to `300.0`):\n                Seconds between sweeper ticks.\n        \"\"\"\n        if not basedir.strip():\n            raise ValueError(\"basedir must not be empty.\")\n        BubblewrapWorkspace._validate_gateway_port(gateway_port)\n        if not share_net:\n            raise ValueError(\n                \"BubblewrapWorkspaceManager currently requires \"\n                \"share_net=True because BubblewrapWorkspace uses a TCP MCP \"\n                \"gateway across separate bwrap executions.\",\n            )\n\n        self._basedir = os.path.abspath(basedir)\n        self._gateway_port = gateway_port\n        self._share_net = share_net\n        self._env = dict(env or {})\n        self._extra_pip = list(extra_pip or [])\n        self._default_mcps = list(default_mcps or [])\n        self._skill_paths = list(skill_paths or [])\n        self._ttl = ttl\n        self._sweep_interval = sweep_interval\n        super().__init__(isolation=isolation)","sourceCodeStart":63,"sourceCodeEnd":99,"githubUrl":"https://github.com/agentscope-ai/agentscope/blob/e90f1c7592896cc95f6e5ee506194f533378247d/src/agentscope/app/workspace_manager/_bubblewrap_workspace_manager.py#L63-L99","documentation":"BubblewrapWorkspaceManager.__init__ rejects an empty (or whitespace-only) basedir because every sandboxed workspace is created underneath it and an empty path is meaningless/unsafe.","triggerScenarios":"Instantiating BubblewrapWorkspaceManager(basedir=\"\") or basedir=\"   \"; commonly when basedir comes from an env var or config key that was never set (defaulting to empty string).","commonSituations":"Missing WORKSPACE_BASEDIR-style env var; config file with an empty basedir field; default parameter changed to '' in a refactor.","solutions":["Pass a non-empty absolute directory path such as /var/lib/agent/workspaces","If basedir comes from config, add a startup check with a sensible default","Fail fast at app boot with a clear message instead of at manager construction"],"exampleFix":"# before\nmgr = BubblewrapWorkspaceManager(basedir=os.getenv(\"WS_DIR\", \"\"))\n# after\nbasedir = os.getenv(\"WS_DIR\") or \"/var/lib/agent/workspaces\"\nmgr = BubblewrapWorkspaceManager(basedir=basedir)","handlingStrategy":"validation","validationCode":"basedir = os.getenv(\\\"WS_BASEDIR\\\") or \\\"/var/lib/agent/workspaces\\\"\\nassert basedir.strip(), \\\"basedir must be configured\\\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Default env-based config values at startup","Add config schema validation at boot"],"tags":["bubblewrap","workspace","config","init-validation"],"backgroundTag":"invalid-configuration","analyzedSha":"e90f1c7592896cc95f6e5ee506194f533378247d","analyzedAt":"2026-08-28T18:24:12.087Z","schemaVersion":2},"datasetVersion":"2026-08-28T21:17:43.275Z"}