v4xsh commented on issue #61381: URL: https://github.com/apache/airflow/issues/61381#issuecomment-3847355963
I’d like to take ownership of this issue and work on a fix. From the traceback, this appears to be a regression tied to stricter **Pydantic v2** validation introduced in **Airflow 3.1.5**. The `DagRunContext` model expects `dag_run.start_date` to be a valid `datetime`, but DAG runs (especially those cleared or migrated from legacy versions like **3.0.6**) can legitimately have `start_date=None` in the database. When the scheduler attempts to construct the context for these runs, it triggers a `ValidationError`. This seems to be a backward-compatibility gap in the core scheduling logic rather than a user configuration error. **Proposed Approach:** * **Model Update**: Evaluate if `start_date` in `DagRunContext` should be changed to `Optional[datetime]` to accommodate cleared states. * **Logic Safeguard**: Alternatively, implement a safe default or data-filling mechanism in `scheduler_job_runner.py` before the model is instantiated during reruns. * **Regression Testing**: Add a test case to simulate clearing a legacy DAG run and ensuring the scheduler loop completes without a `ValidationError`. I can try to reproduce this locally on my environment and am ready to implement the fix once there is a consensus on the preferred path. I would appreciate being assigned to this issue. -- 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]
