Skip to content

Fix execution API returning non-RFC 9457 error for invalid TI state #69360

Description

@KushagraB424

Under which category would you file this issue?

Airflow Core

Apache Airflow version

3.4.0

What happened and how to reproduce it?

Issue Description
In airflow/api_fastapi/execution_api/routes/task_instances.py, when a client tries to start a task instance that is in an invalid state, it throws an HTTPException with a 409 status code. However, the detail object does not comply with the RFC 9457 format for problem details, as noted by an existing TODO in the codebase.

Steps to reproduce
This is a code-level inconsistency marked by a TODO comment at line 217 in airflow-core/src/airflow/api_fastapi/execution_api/routes/task_instances.py.

What you think should happen instead?

The code should be updated to resolve that TODO by ensuring the error detail dictionary contains the standard type, title, status, detail, and instance fields as per RFC 9457, in addition to the existing custom keys (reason and previous_state).

Operating System

No response

Deployment

None

Apache Airflow Provider(s)

No response

Versions of Apache Airflow Providers

Not Applicable

Official Helm Chart version

Not Applicable

Kubernetes Version

Not Applicable

Helm Chart configuration

Not Applicable

Docker Image customizations

Not Applicable

Anything else?

I already have a fix ready on my fork and will be submitting a PR for this shortly!

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:APIAirflow's REST/HTTP APIarea:corekind:bugThis is a clearly a bugneeds-triagelabel for new issues that we didn't triage yet

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions