{"record":{"id":"b11d67cc74dcfbd2","repo":"infiniflow/ragflow","slug":"failed-to-create-sandbox-instance-str-e","errorCode":null,"errorMessage":"Failed to create sandbox instance: {str(e)}","messagePattern":"Failed to create sandbox instance: (.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"agent/sandbox/providers/aliyun_codeinterpreter.py","lineNumber":194,"sourceCode":"            )\n\n            instance_id = sandbox.sandbox_id\n\n            return SandboxInstance(\n                instance_id=instance_id,\n                provider=\"aliyun_codeinterpreter\",\n                status=\"READY\",\n                metadata={\n                    \"language\": language,\n                    \"region\": self.region,\n                    \"account_id\": self.account_id,\n                    \"template_name\": template_name,\n                    \"created_at\": datetime.now(timezone.utc).isoformat(),\n                },\n            )\n\n        except ServerError as e:\n            raise RuntimeError(f\"Failed to create sandbox instance: {str(e)}\")\n        except Exception as e:\n            raise RuntimeError(f\"Unexpected error creating instance: {str(e)}\")\n\n    def execute_code(self, instance_id: str, code: str, language: str, timeout: int = 10, arguments: Optional[Dict[str, Any]] = None) -> ExecutionResult:\n        \"\"\"\n        Execute code in the Aliyun Code Interpreter instance.\n\n        Args:\n            instance_id: ID of the sandbox instance\n            code: Source code to execute\n            language: Programming language (python, javascript)\n            timeout: Maximum execution time in seconds (max 30)\n            arguments: Optional arguments dict to pass to main() function\n\n        Returns:\n            ExecutionResult containing stdout, stderr, exit_code, and metadata\n\n        Raises:","sourceCodeStart":176,"sourceCodeEnd":212,"githubUrl":"https://github.com/infiniflow/ragflow/blob/554fb1133ac3861732235ad9c377eb5e0a770665/agent/sandbox/providers/aliyun_codeinterpreter.py#L176-L212","documentation":"The Aliyun agentrun SDK raised `ServerError` while creating a sandbox instance (template fetch/creation or instance launch). The original server message is embedded. This is an upstream/service-side failure after the provider was correctly initialized.","triggerScenarios":"create_instance when: the `ragflow-<lang>-default` template cannot be listed or created, the account has sandbox quota/limits exceeded, the region endpoint rejects the request, or the Aliyun service returns 5xx.","commonSituations":"Sandbox quota exhausted on the Aliyun account; wrong region or endpoint in config; template name in config refers to a deleted template; transient Aliyun service outages; IAM permissions missing for the Code Interpreter API.","solutions":["Read the embedded ServerError text — quota/permission/region errors are usually explicit.","Verify the configured template_name exists in the target region, or clear it so the default `ragflow-<lang>-default` is (re)created.","Check account quotas and IAM permissions for the Code Interpreter service.","Retry after a short backoff for transient 5xx; create_instance is safe to retry since failure leaves no instance."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"# Fail fast on obviously broken config before touching the API\nrequired = [\"region\", \"account_id\", \"access_key_id\", \"access_key_secret\"]\nmissing = [k for k in required if not config.get(k)]\nif missing:\n    raise ValueError(f\"Aliyun sandbox config missing: {missing}\")","typeGuard":null,"tryCatchPattern":"import time\n\nfor attempt in range(3):\n    try:\n        instance = provider.create_instance(\"python\")\n        break\n    except RuntimeError as e:\n        if \"quota\" in str(e).lower() or attempt == 2:\n            raise\n        time.sleep(2 ** attempt)","preventionTips":["Monitor Aliyun sandbox quota and raise limits before hitting ceilings.","Pre-create the default template once so per-request creation only launches instances.","Alert on ServerError rates from the provider to catch region/endpoint misconfig early."],"tags":["aliyun","provider","api-error","quota"],"backgroundTag":null,"analyzedSha":"554fb1133ac3861732235ad9c377eb5e0a770665","analyzedAt":"2026-08-15T09:20:16.380Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}