{"record":{"id":"dd56c10386ddda36","repo":"BerriAI/litellm","slug":"cannot-parse-iam-endpoint-from-url-missing-databa","errorCode":null,"errorMessage":"Cannot parse IAM endpoint from URL: missing database name","messagePattern":"Cannot parse IAM endpoint from URL: missing database name","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/proxy/db/prisma_client.py","lineNumber":155,"sourceCode":"        try:\n            await self._engine.rollback_transaction(tx_id)\n        finally:\n            self.tracker.end_operation()\n            self.tracker.transaction_finished(tx_id)\n\n\ndef parse_iam_endpoint_from_url(url: str) -> IAMEndpoint:\n    \"\"\"Parse an IAMEndpoint from a Postgres URL.\n\n    Used so a reader URL can drive its own IAM refresh without requiring\n    callers to set parallel DATABASE_HOST_READ_REPLICA / etc. env vars.\n    \"\"\"\n    parsed: Final = urllib.parse.urlparse(url)\n    if not parsed.hostname or not parsed.username:\n        raise ValueError(\"Cannot parse IAM endpoint from URL: missing host or username\")\n    name: Final = (parsed.path or \"/\").lstrip(\"/\")\n    if not name:\n        raise ValueError(\"Cannot parse IAM endpoint from URL: missing database name\")\n    port: Final = str(parsed.port) if parsed.port else \"5432\"\n    schema: str | None = None\n    if parsed.query:\n        qs: Final = urllib.parse.parse_qs(parsed.query)\n        schema_vals: Final = qs.get(\"schema\")\n        if schema_vals:\n            schema = schema_vals[0]\n    return IAMEndpoint(\n        host=parsed.hostname,\n        port=port,\n        user=parsed.username,\n        name=name,\n        schema=schema,\n    )\n\n\nclass PrismaWrapper:\n    \"\"\"","sourceCodeStart":137,"sourceCodeEnd":173,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/db/prisma_client.py#L137-L173","documentation":"Raised by parse_iam_endpoint_from_url when the Postgres URL has host and username but no database-name component (empty path). IAM token refresh needs the full database identity, not just the endpoint; a URL like postgres://user@host:5432/ (or without a path) is rejected. The host/username sibling check raises the neighbouring 'missing host or username' error.","triggerScenarios":"Thrown at litellm/proxy/db/prisma_client.py:155 when the library encounters an invalid state.","commonSituations":"The IAM database URL is missing the database name segment.","solutions":["Include the database name in the URL path used for IAM auth."],"exampleFix":"DATABASE_URL=postgresql://dbuser@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"}