Skip to content

DateTimeSensorAsync is failing #54935

@atul-astronomer

Description

@atul-astronomer

Apache Airflow version

main (development)

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

No response

What happened?

ERROR - Trigger failed:
Traceback (most recent call last):

  File "/opt/airflow/airflow-core/src/airflow/jobs/triggerer_job_runner.py", line 965, in create_triggers
    trigger_instance = trigger_class(**deserialised_kwargs)

  File "/opt/airflow/providers/standard/src/airflow/providers/standard/triggers/temporal.py", line 51, in __init__
    raise TypeError(f"Expected datetime.datetime type for moment. Got {type(moment)}")

TypeError: Expected datetime.datetime type for moment. Got <class 'str'>
[2025-08-26, 12:44:51] ERROR - Task failed with exception
TaskDeferralError: Trigger failure
File "/opt/airflow/task-sdk/src/airflow/sdk/execution_time/task_runner.py", line 919 in run

File "/opt/airflow/task-sdk/src/airflow/sdk/execution_time/task_runner.py", line 1301 in _execute_task

File "/opt/airflow/task-sdk/src/airflow/sdk/bases/sensor.py", line 255 in resume_execution

File "/opt/airflow/task-sdk/src/airflow/sdk/bases/operator.py", line 1614 in resume_execution

What you think should happen instead?

No response

How to reproduce

Run the below dag in main branch:

from airflow.sdk import DAG
from airflow.providers.standard.operators.empty import EmptyOperator
from airflow.providers.standard.operators.python import PythonOperator
from airflow.providers.standard.sensors.date_time import DateTimeSensorAsync
from airflow.utils.trigger_rule import TriggerRule
from pendulum import datetime

with DAG(
    dag_id='example_deferrable_dag',
    start_date=datetime(2023, 1, 1),
    catchup=False,
    tags=['async'],
) as dag:

    start = EmptyOperator(
        task_id='start'
    )

    wait = DateTimeSensorAsync(
        task_id='wait_for_time',
        target_time="""{{ macros.datetime.utcnow() + macros.timedelta(minutes=1) }}"""
    )

    end = EmptyOperator(
        task_id='end'
    )

    start >> wait >> end

Operating System

Linux

Versions of Apache Airflow Providers

No response

Deployment

Other

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    affected_version:3.0Issues Reported for 3.0affected_version:main_branchIssues Reported for main brancharea:async-operatorsAIP-40: Deferrable ("Async") Operatorsarea:corekind:bugThis is a clearly a bugpriority:highHigh priority bug that should be patched quickly but does not require immediate new release

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions