{"record":{"id":"cfe83813b2b7688c","repo":"zylon-ai/private-gpt","slug":"sandbox-client-not-configured","errorCode":null,"errorMessage":"Sandbox client not configured","messagePattern":"Sandbox client not configured","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"private_gpt/components/tabular/pandasai_sandbox.py","lineNumber":159,"sourceCode":"        until the coroutine completes.\n        \"\"\"\n        if self._loop is not None and self._loop.is_running():\n            return asyncio.run_coroutine_threadsafe(coro, self._loop).result()\n        return asyncio.run(coro)\n\n    # ------------------------------------------------------------------\n    # Lifecycle\n    # ------------------------------------------------------------------\n\n    def start(self) -> None:\n        if self._started:\n            return\n\n        logger.debug(\"Starting remote sandbox session for user: %s\", self._user_id)\n\n        try:\n            if self._client is None:\n                raise RuntimeError(\"Sandbox client not configured\")\n            self._temp_dir = Path(\n                tempfile.mkdtemp(prefix=f\"zylon_sandbox_{self._user_id}_\")\n            )\n            self._setup_environment()\n            self._started = True\n            logger.debug(\"Remote sandbox session started successfully\")\n        except Exception as e:\n            logger.error(\"Failed to start remote sandbox: %s\", e)\n            raise RuntimeError(f\"Failed to start sandbox: {e}\") from e\n\n    def stop(self) -> None:\n        if not self._started:\n            return\n\n        logger.debug(\"Stopping remote sandbox session for user: %s\", self._user_id)\n\n        try:\n            if self._client:","sourceCodeStart":141,"sourceCodeEnd":177,"githubUrl":"https://github.com/zylon-ai/private-gpt/blob/4a030776a31a901ad80b1bf4d7faa2c1a367efbb/private_gpt/components/tabular/pandasai_sandbox.py#L141-L177","documentation":"Raised inside PandasAISandboxAdapter.start() when the adapter was constructed without a sandbox client (self._client is None). The adapter wraps a remote code-execution sandbox; start() is the lifecycle entry point that creates a temp dir and runs environment setup through that client, so a missing client is a programming/configuration error, not a runtime failure. It is immediately re-wrapped into 'Failed to start sandbox: ...' by the except block at line 168.","triggerScenarios":"Instantiating PandasAISandboxAdapter with client=None (or default) and then calling start(); constructing the adapter before the sandbox provider is ready; a DI/injection misconfiguration that passes the wrong argument so client ends up None; calling start() again after stop() set _client = None at line 185 (note: _started guard does not cover this case).","commonSituations":"Component wiring errors where SandboxComponent hands a None client; microvm/sandbox provider not provisioned for the deployment; reuse of a stopped adapter (stop() nulls _client but _started is also False, so a second start() hits the None client).","solutions":["Check where the adapter is constructed: ensure a live sandbox client (e.g. MicrovmSandbox client) is passed in, not None.","If reusing after stop(), construct a fresh adapter/client instead of calling start() on a stopped one.","Verify the SandboxComponent configuration actually provisions the remote sandbox in this environment.","Fail fast at construction time: raise in __init__ when client is None so the error surfaces at wiring, not at first use."],"exampleFix":"# before\nsandbox = PandasAISandboxAdapter(client=None, ...)\nsandbox.start()  # RuntimeError: Sandbox client not configured\n\n# after\nif client is None:\n    raise ValueError(\"PandasAISandboxAdapter requires a configured sandbox client\")\nsandbox = PandasAISandboxAdapter(client=client, ...)\nsandbox.start()","handlingStrategy":"validation","validationCode":"def can_start(sandbox) -> bool:\n    return getattr(sandbox, \"_client\", None) is not None\n\n# assert can_start(sandbox) before sandbox.start()","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate client injection at adapter construction time","Never call start() on an adapter built with client=None","After stop(), build a new adapter instead of restarting the old one"],"tags":["sandbox","lifecycle","configuration","dependency-injection"],"backgroundTag":null,"analyzedSha":"4a030776a31a901ad80b1bf4d7faa2c1a367efbb","analyzedAt":"2026-08-15T03:51:26.951Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}