{"record":{"id":"70eaad62edf36c99","repo":"zylon-ai/private-gpt","slug":"execution-failed-result-error-or-unknown-error","errorCode":null,"errorMessage":"Execution failed: {result.error or 'Unknown error'}","messagePattern":"Execution failed: (.+?)","errorType":"exception","errorClass":"CodeExecutionError","httpStatus":null,"severity":"error","filePath":"private_gpt/components/tabular/pandasai_sandbox.py","lineNumber":434,"sourceCode":"                    plt.savefig(_buf, format='png', dpi=150, bbox_inches='tight')\n                    _buf.seek(0)\n                    _image_b64 = base64.b64encode(_buf.getvalue()).decode('utf-8')\n                    _buf.close()\n                    _execution_result['value'] = f\"data:image/png;base64,{_image_b64}\"\n\n            print(\"EXECUTION_RESULT_START\")\n            print(json.dumps(_execution_result, cls=CustomEncoder))\n            print(\"EXECUTION_RESULT_END\")\n        \"\"\"\n        )\n\n        return code\n\n    def _process_execution_result(\n        self, result: SandboxExecutionResult\n    ) -> dict[str, Any]:\n        if not result.success:\n            raise CodeExecutionError(\n                f\"Execution failed: {result.error or 'Unknown error'}\"\n            )\n\n        try:\n            lines = result.output.strip().split(\"\\n\")\n            start_idx: int | None = None\n            end_idx: int | None = None\n\n            for i, line in enumerate(lines):\n                if line.strip() == \"EXECUTION_RESULT_START\":\n                    start_idx = i + 1\n                elif line.strip() == \"EXECUTION_RESULT_END\":\n                    end_idx = i\n                    break\n\n            if start_idx is not None and end_idx is not None:\n                json_str = \"\\n\".join(lines[start_idx:end_idx])\n                json_obj: dict[str, Any] = json.loads(json_str)","sourceCodeStart":416,"sourceCodeEnd":452,"githubUrl":"https://github.com/zylon-ai/private-gpt/blob/4a030776a31a901ad80b1bf4d7faa2c1a367efbb/private_gpt/components/tabular/pandasai_sandbox.py#L416-L452","documentation":"Raised by _process_execution_result when the remote sandbox reports success=False for the run. The sandbox transport returns a SandboxExecutionResult; a failed run carries result.error (stderr/exception from inside the sandbox), which is interpolated, defaulting to 'Unknown error' when the transport gives no detail. This differs from error 246: 246 wraps transport/pre-processing exceptions, 248 handles a completed-but-failed run.","triggerScenarios":"The generated code runs in the sandbox and the sandbox itself marks the run failed: uncaught Python exception in the generated code at the top level, process killed, or sandbox-internal failure. result.error empty while success=False yields 'Unknown error'.","commonSituations":"Generated code calls sys.exit or crashes the interpreter; OOM inside the sandbox; sandbox runtime version mismatch; empty error when the process is killed by signal (no traceback captured).","solutions":["Inspect result.error content when present — it is the sandbox-side traceback.","For 'Unknown error': check sandbox-side logs; a killed/OOM process produces no error text — raise memory limits or simplify the generated analysis.","Retry once — transient sandbox kills usually succeed on regeneration.","Reduce dataset size streamed into the sandbox if memory-bound."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"from pandasai.exceptions import CodeExecutionError\n\ntry:\n    payload = sandbox._process_execution_result(result)\nexcept CodeExecutionError as e:\n    if result.error:\n        log_sandbox_traceback(result.error)  # actionable detail\n        raise\n    retry_analysis_once()  # 'Unknown error' often transient kill","preventionTips":["Check sandbox-side logs when result.error is empty","Raise sandbox memory limits for large-dataset analyses","Treat signal-killed runs (no error text) as memory issues first"],"tags":["sandbox","code-execution","result-processing","oom"],"backgroundTag":null,"analyzedSha":"4a030776a31a901ad80b1bf4d7faa2c1a367efbb","analyzedAt":"2026-08-15T03:51:26.951Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}