Skip to content

cli: Fix TypeError in 'airflow db shell' when database name is missing#68913

Open
sejal-gupta-ksolves wants to merge 1 commit into
apache:mainfrom
sejal-gupta-ksolves:fix/cli-db-shell-typeerror
Open

cli: Fix TypeError in 'airflow db shell' when database name is missing#68913
sejal-gupta-ksolves wants to merge 1 commit into
apache:mainfrom
sejal-gupta-ksolves:fix/cli-db-shell-typeerror

Conversation

@sejal-gupta-ksolves

@sejal-gupta-ksolves sejal-gupta-ksolves commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

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.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

airflow db shell crashes with TypeError when sql_alchemy_conn omits database name while airflow db check succeeds

1 participant