Skip to content

Secrets with slashed IDs return AirflowNotFoundException #57864

Description

@bmanan7

Apache Airflow version

3.1.1

If "Other Airflow 2/3 version" selected, which one?

No response

What happened?

In Airflow 3.x the execution API route GET /execution/connections/{conn_id} treats the connection ID as a FastAPI path segment. Conn IDs containing / (e.g., dev-env/project-name) are not URL encoded before the request, so Starlette splits them into multiple segments and returns 404 even though the connection exists.

airflow connections get (CLI) still works because it bypasses the execution API, causing a mismatch between CLI and Task SDK behaviour.

Apart from this one will also getAirflowNotFoundException when the secret value is defined as {"username":"uname@somedomain.com", "password":"****"} however we don't get the error if we define secret value as show below:

{
 "conn_type": "http",
 "login": "uname@somedomain.com",
 "password": "***",
 "host": "https://api.somedomain.com",
 "port": 443,
 "extra": "{\"verify_ssl\": false}"
}

it looks like without conn_type defined it doesn't work in Airflow3?

What you think should happen instead?

  • / in secret name should be accepted.
  • Either conn_type should be marked as compulsory and documentation should be updated to reflect this or airflow should accept a secret without conn_type

How to reproduce

  • Start an Airflow 3.x environment.

  • Inside the scheduler container, create a connection whose ID contains /. Example script:

python3 - <<'PY'
from airflow import settings
from airflow.models.connection import Connection

conn = Connection(conn_id="dev-env/project-name", conn_type="http", host="example.com")
session = settings.Session()
session.merge(conn)
session.commit()
PY
  • Add a DAG with a task that calls BaseHook.get_connection("dev-env/project-name") .

  • Trigger the DAG. The task fails and worker logs show a 404 from GET /execution/connections/dev-env/project-name.

  • (Optional sanity check) Running airflow connections get dev-env/project-name -oyaml still works because it bypasses the execution API.

Operating System

macOS 15.6.1

Versions of Apache Airflow Providers

No response

Deployment

Official Apache Airflow Helm Chart

Deployment details

No response

Anything else?

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Activity

  1. boring-cyborg commented on Nov 5, 2025

    @boring-cyborg

    Thanks for opening your first issue here! Be sure to follow the issue template! If you are willing to raise PR to address this issue please do so, no need to wait for approval.

  2. diligejy commented on Mar 8, 2026

    @diligejy

    I'd like to work on this issue. I previously commented but deleted it to ensure I follow all project guidelines and perform complete verification (including Breeze/Docker tests) before officially claiming the issue. I have now verified the fix locally using Breeze.

  3. added a commit that references this issue on May 18, 2026
    ec3a992
  4. Samin061 commented on Jul 8, 2026

    @Samin061
    Contributor

    Opened #69585 for the slashed conn_id part. The execution API connections route used the default string path converter, so a conn_id with a / never matched and the task got a 404. Switched it to the :path converter, same as the variables route already does for slashed keys. The conn_type question looks like a separate secrets-backend issue, so I left it out of this PR.

  5. justinpakzad commented on Sep 26, 2026

    @justinpakzad
    Contributor

    I think this can be closed now that #69228 and #69780 have been merged.

  6. HarshXAI commented on Sep 29, 2026

    @HarshXAI
  7. rawwar commented on Nov 14, 2026

    @rawwar
    Contributor

    This issue is fixed with #69228 and #69780 merged. If required, we can create a new issue for #74475 to track

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions