{"record":{"id":"716e00c10957c59c","repo":"infiniflow/ragflow","slug":"provider-not-initialized-call-initialize-first-716e00","errorCode":null,"errorMessage":"Provider not initialized. Call initialize() first.","messagePattern":"Provider not initialized\\. Call initialize\\(\\) first\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"agent/sandbox/providers/e2b.py","lineNumber":84,"sourceCode":"        # For now, we'll mark as initialized but actual API calls will fail\n        self._initialized = True\n        return True\n\n    def create_instance(self, template: str = \"python\") -> SandboxInstance:\n        \"\"\"\n        Create a new sandbox instance in E2B.\n\n        Args:\n            template: Programming language template (python, nodejs, go, bash)\n\n        Returns:\n            SandboxInstance object\n\n        Raises:\n            RuntimeError: If instance creation fails\n        \"\"\"\n        if not self._initialized:\n            raise RuntimeError(\"Provider not initialized. Call initialize() first.\")\n\n        # Normalize language\n        language = self._normalize_language(template)\n\n        # TODO: Implement actual E2B API call\n        # POST /sandbox with template\n        instance_id = str(uuid.uuid4())\n\n        return SandboxInstance(\n            instance_id=instance_id,\n            provider=\"e2b\",\n            status=\"running\",\n            metadata={\n                \"language\": language,\n                \"region\": self.region,\n            },\n        )\n","sourceCodeStart":66,"sourceCodeEnd":102,"githubUrl":"https://github.com/infiniflow/ragflow/blob/554fb1133ac3861732235ad9c377eb5e0a770665/agent/sandbox/providers/e2b.py#L66-L102","documentation":"Guard in E2BProvider.create_instance: the E2B provider was used before initialize(). Note the E2B provider is a stub — create_instance returns a fabricated uuid instance with no real sandbox behind it — so even after initializing, the provider is not functional for execution.","triggerScenarios":"Selecting provider 'e2b' in sandbox configuration and calling create_instance without initialize(), or after a failed initialize().","commonSituations":"Misconfiguration naming e2b as the sandbox provider when the integration was never implemented; copy-paste of provider wiring from another provider class.","solutions":["Call initialize() before create_instance — but note E2B execution is unimplemented.","Switch sandbox provider to 'local' or the self-managed executor for working execution.","Remove/disable the e2b provider in configuration until implemented."],"exampleFix":"# before\nprovider = E2BProvider(...)\ninstance = provider.create_instance(\"python\")\n\n# after: use a implemented provider\nprovider = LocalSandboxProvider(...)\nprovider.initialize(config)\ninstance = provider.create_instance(\"python\")","handlingStrategy":"validation","validationCode":"IMPLEMENTED_PROVIDERS = {\"local\", \"self_managed\", \"aliyun_codeinterpreter\"}\nif provider_name not in IMPLEMENTED_PROVIDERS:\n    raise ValueError(f\"Sandbox provider '{provider_name}' is not implemented; choose one of {sorted(IMPLEMENTED_PROVIDERS)}\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Whitelist implemented providers at startup instead of accepting any configured name.","Treat the e2b provider as a stub: do not route production traffic to it.","Add a startup health_check that fails deployment for stub providers."],"tags":["e2b","provider","lifecycle","unimplemented"],"backgroundTag":null,"analyzedSha":"554fb1133ac3861732235ad9c377eb5e0a770665","analyzedAt":"2026-08-15T09:20:16.380Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}