Skip to content

Web UI returns 404 when switching between task logs with different try numbers #56977

Description

@ido177

Apache Airflow version

3.1.0

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

No response

What happened?

There is a bug in the Airflow Web UI when switching between task logs of different tasks within the same DAG run.
If you open the log of a task that has multiple tries(e.g. second try) and then switch to another task that has fewer tries, the Web UI tries to load the same try_number as before - resulting in a 404 error.

Image

What you think should happen instead?

When switching between tasks, the Web UI should automatically reset the try_number to 1(or to the latest available try for that task), rather than reusing the previous try number.

How to reproduce

  1. Open the log for a task that has more than one try, e.g.
    /dags/some_dag_name/runs/scheduled__2025-10-21T16:03:00+00:00/tasks/task_name?try_number=2
  2. In the Web UI, switch to another task that has only one try.
  3. The UI requests the same try_number=2 for the new task, which doesn’t exist.
  4. The request returns 404 Not Found.
  5. If you remove ?try_number=2 from the URL, the log loads correctly.

Operating System

Debian

Versions of Apache Airflow Providers

No response

Deployment

Official Apache Airflow Helm Chart

Deployment details

No response

Anything else?

This issue makes it confusing when browsing logs for tasks with different retry counts - the page fails instead of gracefully showing the available log.

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Activity

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

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions