{"record":{"id":"91800e10f6cdf1a5","repo":"microsoft/autogen","slug":"logs-all","errorCode":null,"errorMessage":"{logs_all}","messagePattern":"\\{logs_all\\}","errorType":"exception","errorClass":"ConnectionError","httpStatus":null,"severity":"error","filePath":"python/packages/autogen-ext/src/autogen_ext/code_executors/azure/_azure_container_code_executor.py","lineNumber":492,"sourceCode":"                    data = data[\"properties\"]\n                    logs_all += data.get(\"stderr\", \"\") + data.get(\"stdout\", \"\")\n                    if \"Success\" in data[\"status\"]:\n                        if not self._suppress_result_output:\n                            logs_all += str(data[\"result\"])\n                    elif \"Failure\" in data[\"status\"]:\n                        exitcode = 1\n\n                except asyncio.TimeoutError as e:\n                    logs_all += \"\\n Timeout\"\n                    # e.add_note is only in py 3.11+\n                    raise asyncio.TimeoutError(logs_all) from e\n                except asyncio.CancelledError as e:\n                    logs_all += \"\\n Cancelled\"\n                    # e.add_note is only in py 3.11+\n                    raise asyncio.CancelledError(logs_all) from e\n                except aiohttp.ClientResponseError as e:\n                    logs_all += \"\\nError while sending code block to endpoint\"\n                    raise ConnectionError(logs_all) from e\n\n        return CodeResult(exit_code=exitcode, output=logs_all)\n\n    async def restart(self) -> None:\n        \"\"\"(Experimental) Restart the code executor.\n\n        Resets the internal state of the executor by generating a new session ID and resetting the setup variables.\n        This causes the next code execution to reinitialize the environment and re-run any setup code.\n        \"\"\"\n        self._session_id = str(uuid4())\n        self._setup_functions_complete = False\n        self._access_token = None\n        self._available_packages = None\n        self._setup_cwd_complete = False\n\n    async def start(self) -> None:\n        \"\"\"(Experimental) Start the code executor.\n","sourceCodeStart":474,"sourceCodeEnd":510,"githubUrl":"https://github.com/microsoft/autogen/blob/027ecf0a379bcc1d09956d46d12d44a3ad9cee14/python/packages/autogen-ext/src/autogen_ext/code_executors/azure/_azure_container_code_executor.py#L474-L510","documentation":"This is the aggregated `logs_all` string raised as ConnectionError when sending a code block to the Azure session endpoint fails with an HTTP error status inside execute_code_blocks. The message contains all accumulated stdout/stderr so far plus the trailing line 'Error while sending code block to endpoint'. Sibling branches raise TimeoutError(logs_all) on timeout and CancelledError(logs_all) on cancellation.","triggerScenarios":"Calling execute_code_blocks when the POST to the session's execute API returns 4xx/5xx: expired token (401), stale session id (404), payload too large (code block with huge embedded data), or service errors. Also raised (as TimeoutError with the same logs shape) when execution exceeds the configured timeout, and as CancelledError when the cancellation_token fires.","commonSituations":"Agents generating very large code blocks (e.g. embedding a DataFrame inline) that exceed request limits; executors held across long agent conversations until the token expires; first-call races where the ACI session is still provisioning.","solutions":["Read the tail of logs_all: it states whether this is an endpoint error, a timeout, or a cancellation; that determines the fix","For 401/404 causes, call restart() and retry the code block; the new session re-runs setup","For timeouts, raise the executor's timeout parameter (constructor) or split the workload into smaller blocks","For oversized payloads, move data via upload_files instead of inlining it in code"],"exampleFix":"# before\nresult = await executor.execute_code_blocks(blocks, ct)  # may raise ConnectionError/TimeoutError with logs\n\n# after\ntry:\n    result = await executor.execute_code_blocks(blocks, ct)\nexcept ConnectionError as e:\n    await executor.restart()\n    result = await executor.execute_code_blocks(blocks, ct)\nexcept asyncio.TimeoutError:\n    executor = AzureContainerCodeExecutor(timeout=300, ...)  # rebuild with longer timeout\n    result = await executor.execute_code_blocks(blocks, ct)","handlingStrategy":"try-catch","validationCode":"null","typeGuard":"null","tryCatchPattern":"try:\n    result = await executor.execute_code_blocks(blocks, ct)\nexcept asyncio.TimeoutError:\n    result = await run_with_longer_timeout(blocks)  # rebuild executor with larger timeout\nexcept asyncio.CancelledError:\n    raise  # user-initiated cancellation: propagate\nexcept ConnectionError as e:\n    if \"sending code block\" in str(e):\n        await executor.restart()\n        result = await executor.execute_code_blocks(blocks, ct)\n    else:\n        raise","preventionTips":["Set timeout generously at construction (default 60s is tight for pip/ml workloads)","Upload data files instead of inlining them in code blocks to avoid payload limits","Distinguish the three shapes: ConnectionError (endpoint), TimeoutError, CancelledError — each has a different remedy"],"tags":["azure","code-execution","network","timeout"],"backgroundTag":null,"analyzedSha":"027ecf0a379bcc1d09956d46d12d44a3ad9cee14","analyzedAt":"2026-08-15T03:38:00.719Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}