sejal-gupta-ksolves opened a new pull request, #68913: URL: https://github.com/apache/airflow/pull/68913
closes: #68897 ### Problem When configuring the `AIRFLOW__DATABASE__SQL_ALCHEMY_CONN` environment variable without explicitly appending a database name component to the URI path (e.g., `postgresql://postgres:postgres@postgres:5432`), the command `airflow db check` passes gracefully. However, running `airflow db shell` crashes with an unhandled, cryptic `TypeError: expected str, bytes or os.PathLike object, not NoneType`. This occurs because the underlying URL parser extracts the missing database component as `None`, which is then forwarded to a subprocess environment dictionary mapping (`env["PGDATABASE"] = url.database`), ultimately crashing internal operating system utility calls (`os.fsencode`). ### Solution Updated the `shell` command function inside `airflow/cli/commands/db_command.py` to add a global validation guardrail check right after retrieving the database URL structure. If `url.database` evaluates to `None` or is empty, the command now proactively raises a clean, standard Python built-in `ValueError` detailing that the configuration is invalid. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
