Skip to content

Unhandled Exception in remote logging if connection doesn't exist #54498

Closed

Description

@csp33

Apache Airflow version

3.0.4

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

No response

What happened?

After upgrading our Airflow deployment from version 3.0.3 to 3.0.4, all tasks started to fail with a RuntimeError: generator didn't yield. Our Airflow instance is deployed on Kubernetes and is configured to use S3 for remote logging.

The error occurred because a missing aws_default connection caused a failure during the logging setup phase for tasks. This seems to be a new requirement in version 3.0.4 that wasn't present in 3.0.3, or a regression that causes a critical failure when the connection is absent.

Worker logs traceback:

2025-08-14 09:02:05.978736 [warning  ] Server error              [airflow.sdk.api.client] detail={'detail': {'reason': 'not_found', 'message': 'Connection with ID aws_default not found'}}
2025-08-14 09:02:05.979060 [error    ] Connection not found          [airflow.sdk.api.client] conn_id=aws_default detail={'detail': {'reason': 'not_found', 'message': 'Connection with ID aws_default not found'}} status_code=404
2025-08-14 09:02:05.985273 [error    ] Task execute_workload[fe7b5051-82c5-4dec-880d-e4e7c37b3ef2] raised unexpected: RuntimeError("generator didn't yield") [celery.app.trace]

The traceback points to this line in the code:
https://github.com/apache/airflow/blob/3.0.4/task-sdk/src/airflow/sdk/execution_time/supervisor.py#L1700

│ /app/.venv/lib/python3.11/site-packages/airflow/sdk/execution_time/supervisor.py:1700 in      │
│ _configure_logging                                                                           │
│                                                                                              │
│ ❱ 1700    with _remote_logging_conn(client):                                                 │
...
RuntimeError: generator didn't yield

What you think should happen instead?

Tasks should execute successfully. If a connection is required for remote logging, Airflow should either:

  • Use a different, non-critical logging path if the connection is missing and warn users.

  • Provide a clear, helpful error message about the missing connection instead of a cryptic RuntimeError: generator didn't yield.

  • Include a warning in the release notes about the new requirement for a aws_default connection when using S3 remote logging.

How to reproduce

  • Deploy an Airflow instance on Kubernetes.

  • Configure remote_logging to use S3 in airflow.cfg or through environment variables.

  • Ensure that there is no Airflow connection named aws_default.

  • Upgrade the Airflow version to 3.0.4.

  • Run a DAG with one or more tasks.

  • Observe the task failure and the logs.

Operating System

Airflow in k8s

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. added
    kind:bug
    needs-triage
    on Aug 14, 2025
  2. added
    provider:amazon
    on Aug 14, 2025
  3. changed the title [-]Exception in remote logging if connection doesn't exist[/-] [+]Unhandled Exception in remote logging if connection doesn't exist[/+] on Aug 14, 2025
  4. csp33 commented on Aug 14, 2025

    @csp33
    ContributorAuthor

    Probably related: #53719

  5. eladkal commented on Aug 14, 2025

    @eladkal
    Contributor
  6. ashb commented on Aug 14, 2025

    @ashb
    Member

    Yeah the error should be improved, but I think an exception is the right behaviour here?

  7. added this to the Airflow 3.0.6 milestone on Aug 14, 2025
  8. ashb commented on Aug 14, 2025

    @ashb
    Member

    We could continue to log things to a local file, and in that file log that the remote log couldn't be uploaded -- I can see that perhaps being more useful than the current behaviour too

  9. added
    affected_version:3.0
    and removed
    needs-triage
    on Aug 15, 2025
  10. 4 remaining items

  11. dada-engineer commented on Dec 11, 2025

    @dada-engineer
    Contributor

    The overall problem is that the api server is called and the connection is requested via API call. This endpoint only checks if there is one in the DB. If not it returns a 404. So all the env var specified connections are ignored here. I would argue that these even should have priority. Why not check the env var created connections before calling the API server anyways? @ashb

    Edit: I do understand why the API server does not return these connections as they have never been shown in the UI. Still for internal usage env var specified connections seem to be less useful.

    Edit2: TLDR; Add the connection via UI or deployment hook to the actual airflow DB connections.

  12. added
    affected_version:3.1
    on Dec 23, 2025
  13. potiuk commented on Dec 23, 2025

    @potiuk
    Member

    I think this has been already handled better in latest airflow 3.1.5 -> but I am not really sure, it should be re-verified in 3.1.5 and reported back here.

  14. dada-engineer commented on Jan 15, 2026

    @dada-engineer
    Contributor

    I think this has been already handled better in latest airflow 3.1.5 -> but I am not really sure, it should be re-verified in 3.1.5 and reported back here.

    I have deployed 3.1.6 to try this and still face the same issue @potiuk.

  15. ginolegigot commented on Jan 20, 2026

    @ginolegigot
    Contributor

    for people stumbling upon this after migrating from 2.11 to 3.1.6, setting remote_conn_id https://airflow.apache.org/docs/apache-airflow/stable/configurations-ref.html#remote-log-conn-id for aws (i guess but did not try) or gcp default connections fixes the issue.
    In my case, I wanted to remote log to a gcs bucket:

    remote_logging = True
    remote_base_log_folder = gs://my-bucket/my-path
    remote_log_conn_id = my-default-gcp-connection

    To create a default gcp connection, select create a google cloud connection type, no need for extra parameters, set a conn_id and put this conn id in remote_log_conn_id.

  16. dada-engineer commented on Jan 21, 2026

    @dada-engineer
    Contributor

    for people stumbling upon this after migrating from 2.11 to 3.1.6, setting remote_conn_id https://airflow.apache.org/docs/apache-airflow/stable/configurations-ref.html#remote-log-conn-id for aws (i guess but did not try) or gcp default connections fixes the issue. In my case, I wanted to remote log to a gcs bucket:

    remote_logging = True
    remote_base_log_folder = gs://my-bucket/my-path
    remote_log_conn_id = my-default-gcp-connection

    To create a default gcp connection, select create a google cloud connection type, no need for extra parameters, set a conn_id and put this conn id in remote_log_conn_id.

    Actually if you create the connection you can create any no need to call this default. It just matters that the API server can find this in the DB. Interestingly enough I only face this issue in AWS not Azure...

  17. sagu2602 commented on Mar 4, 2026

    @sagu2602

    How to fix it? We are using 3.1.7
    Does that mean remote_logging with s3 won't work at all?

  18. dada-engineer commented on Mar 4, 2026

    @dada-engineer
    Contributor

    How to fix it? We are using 3.1.7 Does that mean remote_logging with s3 won't work at all?

    nono @sagu2602 this does not mean it is unusable. It just means you have to create the connection in the db (either via cli or UI). Depending on what you are using as aws auth mechanism (we run in EKS and can benefit from automatic identity web tokens injection into the pod based on service account IAM role, so it only needs a name), you also have to configure this then.

  19. ForeverWintr commented on Mar 5, 2026

    @ForeverWintr
    Contributor

    We ran into this issue on 3.0.6 and I can confirm that adding an empty aws_default connection fixes it.

    It looks to me like the current version of _remote_logging_conn shouldn't have this issue, so hopefully it is included in the next release.

  20. o-nikolas commented on Mar 5, 2026

    @o-nikolas
    Contributor

    I was just looking into this as well. It seems that #59801 fixes it. And it was not backported into either 3.1.6 or 3.1.7 since it wasn't the specific intention of the PR to fix that bug so no one noticed perhaps?

    It will be included in 3.2 of course, but we could consider backporting it for the upcoming 3.1.8 release @vatsrahul1001

  21. vatsrahul1001 commented on Mar 6, 2026

    @vatsrahul1001
    Contributor

    #59801

    I was just looking into this as well. It seems that #59801 fixes it. And it was not backported into either 3.1.6 or 3.1.7 since it wasn't the specific intention of the PR to fix that bug so no one noticed perhaps?

    It will be included in 3.2 of course, but we could consider backporting it for the upcoming 3.1.8 release @vatsrahul1001

    Targeting this for 3.1.9. The 3.1.8 release process has already started, and the change may require more testing.

  22. Dev-iL commented on Mar 6, 2026

    @Dev-iL
    Collaborator

    Backport here: #62979

  23. eladkal commented on Mar 6, 2026

    @eladkal
    Contributor

    Closing as solved #59801

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    affected_version:3.0affected_version:3.1area:corearea:logginggood first issuekind:bugprovider:amazon

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions