{"record":{"id":"e271bc0c5d5dfdf5","repo":"BerriAI/litellm","slug":"env-var-uses-unsupported-scheme-scheme-lite","errorCode":null,"errorMessage":"{env_var} uses unsupported scheme '{scheme}'. LiteLLM's database features (virtual keys, store_model_in_db, spend tracking) require PostgreSQL; use a 'postgresql://' connection string. SQLite and other engines are not supported. See https://docs.litellm.ai/docs/proxy/virtual_keys","messagePattern":"(.+?) uses unsupported scheme '(.+?)'\\. LiteLLM's database features \\(virtual keys, store_model_in_db, spend tracking\\) require PostgreSQL; use a 'postgresql://' connection string\\. SQLite and other engines are not supported\\. See https://docs\\.litellm\\.ai/docs/proxy/virtual_keys","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"litellm/proxy/db/db_url_settings.py","lineNumber":272,"sourceCode":"    def _raise_for_unsupported_scheme(self) -> None:\n        \"\"\"Reject an operator-pinned non-PostgreSQL writer / direct / reader URL.\n\n        The componentized entrypoints (gateway / backend / migrations) call\n        ``apply_to_env`` and then hand the URL straight to Prisma, bypassing\n        the CLI's own guard. A pinned URL flows through untouched, so validate\n        the same three vars the CLI guard checks (DATABASE_URL, DIRECT_URL, and\n        the read replica) rather than letting Prisma stall on an unusable scheme.\n        \"\"\"\n        for env_var, url in (\n            (\"DATABASE_URL\", self.database_url),\n            (\"DIRECT_URL\", self.direct_url),\n            (\"DATABASE_URL_READ_REPLICA\", self.database_url_read_replica),\n        ):\n            if not url:\n                continue\n            bad_scheme = unsupported_db_scheme(url)\n            if bad_scheme is not None:\n                raise RuntimeError(unsupported_db_scheme_message(env_var, bad_scheme))\n\n    def apply_to_env(self) -> bool:\n        \"\"\"Write the assembled URL(s) into ``os.environ``.\n\n        Returns True iff this call set ``DATABASE_URL`` (IAM mint, or\n        password auth that assembled a fresh URL). False means there was\n        nothing to do — an operator-pinned URL, or no discrete fields.\n        \"\"\"\n        self._raise_for_unsupported_scheme()\n        wrote_writer = False\n        writer_url: Final = self.build_writer_url()\n        if writer_url is not None:\n            os.environ[\"DATABASE_URL\"] = writer_url\n            if self.iam_token_db_auth:\n                # Normalize the toggle so downstream readers (PrismaWrapper's\n                # IAM refresh) reliably see IAM on, regardless of spelling.\n                os.environ[_IAM_ENV_KEY] = \"True\"\n            wrote_writer = True","sourceCodeStart":254,"sourceCodeEnd":290,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/db/db_url_settings.py#L254-L290","documentation":"Error \"{env_var} uses unsupported scheme '{scheme}'. LiteLLM's database features (virtual keys, store_model_in_db, spend tracking) require PostgreSQL; use a 'postgresql://' connection string. SQLite and other engines are not supported. See https://docs.litellm.ai/docs/proxy/virtual_keys\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/proxy/db/db_url_settings.py:272 when the library encounters an invalid state.","commonSituations":"The database URL uses an unsupported scheme such as sqlite://.","solutions":["Use a postgresql:// connection string for the named env var.","SQLite and other engines are not supported for LiteLLM database features."],"exampleFix":"export DATABASE_URL=postgresql://user:pass@host:5432/litellm","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}