{"record":{"id":"278170befa706b50","repo":"apache/superset","slug":"connection-failed-please-check-your-connection-se","errorCode":null,"errorMessage":"Connection failed, please check your connection settings","messagePattern":"Connection failed, please check your connection settings","errorType":"exception","errorClass":"DatabaseConnectionFailedError","httpStatus":500,"severity":"error","filePath":"superset/commands/database/create.py","lineNumber":92,"sourceCode":"            return self._create_database()\n        except (\n            SupersetErrorsException,\n            SSHTunnelingNotEnabledError,\n            SSHTunnelDatabasePortError,\n            SSHTunnelHostKeyVerificationError,\n        ) as ex:\n            event_logger.log_with_context(\n                action=f\"db_creation_failed.{ex.__class__.__name__}\",\n                engine=engine,\n            )\n            # So we can show the original message\n            raise\n        except Exception as ex:\n            event_logger.log_with_context(\n                action=f\"db_creation_failed.{ex.__class__.__name__}\",\n                engine=engine,\n            )\n            raise DatabaseConnectionFailedError() from ex\n\n        try:\n            # create database and associated schema/catalog permissions\n            database = self._create_database()\n            add_permissions(database)\n        except (\n            SSHTunnelInvalidError,\n            SSHTunnelCreateFailedError,\n            SSHTunnelingNotEnabledError,\n            SSHTunnelDatabasePortError,\n        ) as ex:\n            event_logger.log_with_context(\n                action=f\"db_creation_failed.{ex.__class__.__name__}.ssh_tunnel\",\n                engine=engine,\n            )\n            # So we can show the original message\n            raise\n        except (","sourceCodeStart":74,"sourceCodeEnd":110,"githubUrl":"https://github.com/apache/superset/blob/f4587218dd19d046c3e4d00063e7d27f8a2ed354/superset/commands/database/create.py#L74-L110","documentation":"DatabaseConnectionFailedError raised in CreateDatabaseCommand.run (create.py:92) when TestConnectionDatabaseCommand(...).run() blows up with any exception not in the OAuth2/SSH special-case lists. Superset deliberately opens a test connection to the target database before persisting it; any generic failure (bad credentials, DNS, firewall, missing driver, unsupported engine) becomes this error.","triggerScenarios":"POST /api/v1/database/ (or /test_connection) where the sqlalchemy_uri points to an unreachable host, wrong port, non-existent database, wrong username/password, or the DBAPI driver for that engine is not installed in the Superset environment.","commonSituations":"Typos in host/port; credentials rotated out-of-band; the database only reachable from a different network segment (Superset container cannot resolve/resolve internal DNS); missing drivers like psycopg2, pymysql, or cx_Oracle; TLS/SSL requirements not encoded in the URI.","solutions":["Verify connectivity from the Superset host/container: psql/mysql/nc to the same host:port, same credentials.","Correct the sqlalchemy_uri (scheme, host, port, db name) and embed any required SSL params.","Install the missing driver for that engine (check requirements/ and the DB engine docs) and restart Superset.","Compare with the OAuth2/SSH exceptions: if the failure is OAuth2-related the create still proceeds — otherwise treat this as a hard connectivity failure.","Check on the database side for host-based auth / IP allowlisting of the Superset host."],"exampleFix":"# before\nsqlalchemy_uri: \"postgresql://user:pass@db.internal:5432/analytics\"\n# -> DatabaseConnectionFailedError (DNS/firewall)\n\n# after: reachable host + ssl\nsqlalchemy_uri: \"postgresql://user:pass@db.prod.example.com:5432/analytics?sslmode=require\"","handlingStrategy":"try-catch","validationCode":"from sqlalchemy.engine import make_url\n\ndef uri_is_wellformed(uri: str) -> bool:\n    try:\n        make_url(uri)\n        return bool(make_url(uri).get_backend_name())\n    except Exception:\n        return False","typeGuard":null,"tryCatchPattern":"from superset.commands.database.exceptions import DatabaseConnectionFailedError\n\ntry:\n    CreateDatabaseCommand(data).run()\nexcept DatabaseConnectionFailedError:\n    # show connection diagnostics UI: host/port/credentials/driver hints\n    ...","preventionTips":["Run POST /api/v1/database/test_connection before the create call.","Verify network reachability and driver availability from the Superset container, not your laptop.","Encode TLS requirements in the URI (e.g. ?sslmode=require) up front."],"tags":["database","connection","network","driver","create"],"backgroundTag":null,"analyzedSha":"f4587218dd19d046c3e4d00063e7d27f8a2ed354","analyzedAt":"2026-08-14T22:39:27.425Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}