{"record":{"id":"aad9b1af9c654d1c","repo":"agentscope-ai/agentscope","slug":"host-workdir-must-not-be-empty-aad9b1","errorCode":null,"errorMessage":"host_workdir must not be empty.","messagePattern":"host_workdir must not be empty\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/agentscope/workspace/_bubblewrap/_bubblewrap_workspace.py","lineNumber":134,"sourceCode":"                For a persistent ``host_workdir``, keep this list stable\n                across workspace instances; changing it does not currently\n                invalidate an existing Bootstrap environment.\n            instructions (`str`, optional):\n                System-prompt fragment template.\n            default_mcps (`list[MCPClient] | None`, optional):\n                MCPs seeded on first initialization.\n            skill_paths (`list[str] | None`, optional):\n                Local skill directories seeded on first initialization.\n        \"\"\"\n        self._validate_gateway_port(gateway_port)\n        if not share_net:\n            raise ValueError(\n                \"BubblewrapWorkspace currently requires share_net=True \"\n                \"because its TCP MCP gateway must be reachable across \"\n                \"separate bwrap executions.\",\n            )\n        if host_workdir is not None and not host_workdir.strip():\n            raise ValueError(\"host_workdir must not be empty.\")\n        if host_cache_dir is not None and not host_cache_dir.strip():\n            raise ValueError(\"host_cache_dir must not be empty.\")\n\n        super().__init__(\n            workspace_id=workspace_id,\n            default_mcps=default_mcps,\n            skill_paths=skill_paths,\n        )\n\n        self.workdir = SANDBOX_WORKDIR\n        self.gateway_port = gateway_port\n        self._gateway_port_input = gateway_port\n        self._gateway_token = \"\"\n        self._gateway_nonce = \"\"\n        self._rotate_gateway_credentials()\n        self.share_net = share_net\n        self.env = dict(env or {})\n        self.extra_pip = list(extra_pip or [])","sourceCodeStart":116,"sourceCodeEnd":152,"githubUrl":"https://github.com/agentscope-ai/agentscope/blob/e90f1c7592896cc95f6e5ee506194f533378247d/src/agentscope/workspace/_bubblewrap/_bubblewrap_workspace.py#L116-L152","documentation":"host_workdir is validated to be non-empty after stripping whitespace. Passing '' or '   ' is rejected because a blank path cannot anchor the host-side workspace directory.","triggerScenarios":"BubblewrapWorkspace(host_workdir='') or host_workdir='   '; commonly from unfilled config/env vars defaulting to empty strings.","commonSituations":"os.environ.get('WORKDIR', '') or empty fields in YAML/TOML config feeding the constructor.","solutions":["Supply a real absolute path, or pass None to let the workspace create and own a temp directory","Guard config: value = cfg.get('host_workdir') or None before constructing"],"exampleFix":"# before\nws = BubblewrapWorkspace(host_workdir=os.environ.get('WS_DIR', ''))\n# after\nws = BubblewrapWorkspace(host_workdir=os.environ.get('WS_DIR') or None)","handlingStrategy":"validation","validationCode":"host_workdir = host_workdir.strip() if host_workdir and host_workdir.strip() else None","typeGuard":"def non_empty_or_none(v: str | None) -> str | None:\n    return v.strip() or None if isinstance(v, str) else None","tryCatchPattern":"null","preventionTips":["Normalize '' to None at your config boundary","Type config fields as string|null"],"tags":["bubblewrap","config","validation","empty-string"],"backgroundTag":"empty-config-value","analyzedSha":"e90f1c7592896cc95f6e5ee506194f533378247d","analyzedAt":"2026-08-28T18:24:12.087Z","schemaVersion":2},"datasetVersion":"2026-08-28T21:17:43.275Z"}