jason810496 opened a new pull request, #66302:
URL: https://github.com/apache/airflow/pull/66302

   
   * related: https://github.com/apache/airflow/pull/64833
   
   ## Why
   
   While working on adding E2E test for event driving Dag with Kafka in #64833, 
I encounter the following error:
   
   ```
     airflow-triggerer-1  | 2026-05-02T15:25:00.831436Z [error    ] Trigger ID 
1 exited with error 'AwaitMessageTrigger' object has no attribute 
'_task_instance' [airflow.jobs.triggerer_job_runner] error_detail=[{'exc_type': 
'AttributeError', 'exc_value': "'AwaitMessageTrigger' object has no attribute 
'_task_instance'", 'exc_notes': [], 'syntax_error': None, 'is_cause': False, 
'frames': [{'filename': 
'/home/airflow/.local/lib/python3.10/site-packages/airflow/jobs/triggerer_job_runner.py',
 'lineno': 1238, 'name': 'cleanup_finished_triggers'}, {'filename': 
'/home/airflow/.local/lib/python3.10/site-packages/greenback/_impl.py', 
'lineno': 119, 'name': 'greenback_shim'}, {'filename': 
'/home/airflow/.local/lib/python3.10/site-packages/greenback/_impl.py', 
'lineno': 208, 'name': '_greenback_shim'}, {'filename': 
'/home/airflow/.local/lib/python3.10/site-packages/greenback/_impl.py', 
'lineno': 84, 'name': 'trampoline'}, {'filename': 
'/home/airflow/.local/lib/python3.10/site-packages/outcome/_
 impl.py', 'lineno': 185, 'name': 'send'}, {'filename': 
'/home/airflow/.local/lib/python3.10/site-packages/airflow/jobs/triggerer_job_runner.py',
 'lineno': 1387, 'name': 'run_trigger'}, {'filename': 
'/home/airflow/.local/lib/python3.10/site-packages/airflow/triggers/base.py', 
'lineno': 104, 'name': 'task_instance'}], 'is_group': False, 'exceptions': []}] 
loc=triggerer_job_runner.py:929
     airflow-triggerer-1  | 2026-05-02T15:25:00.832067Z [error    ] Trigger 
exited without sending an event. Dependent tasks will be failed. 
[airflow.jobs.triggerer_job_runner] loc=triggerer_job_runner.py:929 name='ID 1'
     airflow-triggerer-1  | 2026-05-02T15:25:02.858280Z [error    ] Trigger ID 
1 exited with error 'AwaitMessageTrigger' object has no attribute 
'_task_instance' [airflow.jobs.triggerer_job_runner] error_detail=[{'exc_type': 
'AttributeError', 'exc_value': "'AwaitMessageTrigger' object has no attribute 
'_task_instance'", 'exc_notes': [], 'syntax_error': None, 'is_cause': False, 
'frames': [{'filename': 
'/home/airflow/.local/lib/python3.10/site-packages/airflow/jobs/triggerer_job_runner.py',
 'lineno': 1238, 'name': 'cleanup_finished_triggers'}, {'filename': 
'/home/airflow/.local/lib/python3.10/site-packages/greenback/_impl.py', 
'lineno': 119, 'name': 'greenback_shim'}, {'filename': 
'/home/airflow/.local/lib/python3.10/site-packages/greenback/_impl.py', 
'lineno': 208, 'name': '_greenback_shim'}, {'filename': 
'/home/airflow/.local/lib/python3.10/site-packages/greenback/_impl.py', 
'lineno': 84, 'name': 'trampoline'}, {'filename': 
'/home/airflow/.local/lib/python3.10/site-packages/outcome/_
 impl.py', 'lineno': 185, 'name': 'send'}, {'filename': 
'/home/airflow/.local/lib/python3.10/site-packages/airflow/jobs/triggerer_job_runner.py',
 'lineno': 1387, 'name': 'run_trigger'}, {'filename': 
'/home/airflow/.local/lib/python3.10/site-packages/airflow/triggers/base.py', 
'lineno': 104, 'name': 'task_instance'}], 'is_group': False, 'exceptions': []}] 
loc=triggerer_job_runner.py:929
   ```
   
   The root cause is: `AwaitMessageTrigger.__init__` never calls 
`super().__init__()`, so `_task_instance` is never set. The triggerer crashes 
on cleanup with `AttributeError: 'AwaitMessageTrigger' object has no attribute 
'_task_instance'`, and dependent tasks fail.
   
   ## What
   
   - Call `super().__init__()` in `AwaitMessageTrigger.__init__`.
   - Add a unit test asserting `_task_instance` / `task_instance` are 
initialized after construction.
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [x] Yes, with help of Claude Code <current model name> following [the 
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to