agentscope-ai/agentscope · error · ValueError

BubblewrapWorkspaceManager currently requires share_net=True

Error message

BubblewrapWorkspaceManager currently requires share_net=True because BubblewrapWorkspace uses a TCP MCP gateway across separate bwrap executions.

What it means

BubblewrapWorkspaceManager requires share_net=True because its BubblewrapWorkspace implementation talks to a TCP MCP gateway across separate bwrap executions, which needs a shared network namespace. Constructing the manager with share_net=False raises this immediately.

Source

Thrown at src/agentscope/app/workspace_manager/_bubblewrap_workspace_manager.py:84

                gateway design.
            env (`dict[str, str] | None`, optional):
                Extra environment variables for every workspace.
            extra_pip (`list[str] | None`, optional):
                Extra gateway venv requirements.
            default_mcps (`list[MCPClient] | None`, optional):
                MCPs seeded into new workspaces.
            skill_paths (`list[str] | None`, optional):
                Skill dirs seeded into new workspaces.
            ttl (`float`, defaults to `3600.0`):
                Seconds before an idle workspace is evicted.
            sweep_interval (`float`, defaults to `300.0`):
                Seconds between sweeper ticks.
        """
        if not basedir.strip():
            raise ValueError("basedir must not be empty.")
        BubblewrapWorkspace._validate_gateway_port(gateway_port)
        if not share_net:
            raise ValueError(
                "BubblewrapWorkspaceManager currently requires "
                "share_net=True because BubblewrapWorkspace uses a TCP MCP "
                "gateway across separate bwrap executions.",
            )

        self._basedir = os.path.abspath(basedir)
        self._gateway_port = gateway_port
        self._share_net = share_net
        self._env = dict(env or {})
        self._extra_pip = list(extra_pip or [])
        self._default_mcps = list(default_mcps or [])
        self._skill_paths = list(skill_paths or [])
        self._ttl = ttl
        self._sweep_interval = sweep_interval
        super().__init__(isolation=isolation)

        self._cache: dict[str, tuple[BubblewrapWorkspace, float]] = {}
        self._lock = asyncio.Lock()

View on GitHub (pinned to e90f1c7592)

Solutions

  1. Set share_net=True explicitly when constructing BubblewrapWorkspaceManager
  2. If network isolation is required, restrict egress with firewall rules around the gateway port instead of share_net=False
  3. Consider DockerWorkspaceManager if its isolation model fits better

Example fix

# before
mgr = BubblewrapWorkspaceManager(basedir=d, share_net=False)
# after
mgr = BubblewrapWorkspaceManager(basedir=d, share_net=True, gateway_port=port)
Defensive patterns

Strategy: validation

Validate before calling

mgr = BubblewrapWorkspaceManager(basedir=d, share_net=True)

Prevention

When it happens

Trigger: Passing share_net=False (or relying on a default of False) to BubblewrapWorkspaceManager.__init__.

Common situations: Hardening sandboxes and disabling networking without knowing the MCP gateway dependency; copying options from a DockerWorkspaceManager config; version upgrade that introduced the gateway design.

Related errors


AI-assisted analysis of agentscope-ai/agentscope@e90f1c7592 (2026-08-28). Data as JSON: /api/errors/654ea4b0778f19eb. Report an issue: GitHub.