Skip to content

Regression: DAG import fails with HITLOperator when params have no explicit default (ParamValidationError) #59551

@jgoedeke

Description

@jgoedeke

Apache Airflow version

3.1.5

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

No response

What happened?

When using the HITLOperator, if a DAG param does not have an explicit default value, DAG import fails with a ParamValidationError (previously this worked). See error in logs:

[2025-12-16 16:44:52] ERROR - Failed to import: /opt/airflow/dags/legacy_data_processing/mydag.py
ParamValidationError: Invalid input for param my_param: No value passed and Param has no default value
  File "/home/airflow/.local/lib/python3.11/site-packages/airflow/models/dagbag.py", line 405 in parse
  File "<frozen importlib._bootstrap_external>", line 940 in exec_module
  File "<frozen importlib._bootstrap>", line 241 in _call_with_frames_removed
  File "/opt/airflow/dags/legacy_data_processing/mydag.py", line 438 in <module>
  File "/home/airflow/.local/lib/python3.11/site-packages/airflow/sdk/definitions/dag.py", line 1557 in factory
  File "/opt/airflow/dags/legacy_data_processing/mydag.py", line 228 in mydag
  File "/home/airflow/.local/lib/python3.11/site-packages/airflow/sdk/bases/operator.py", line 522 in apply_defaults
  File "/home/airflow/.local/lib/python3.11/site-packages/airflow/providers/standard/operators/hitl.py", line 101 in __init__
  File "/home/airflow/.local/lib/python3.11/site-packages/airflow/providers/standard/operators/hitl.py", line 121 in validate_params
  File "/home/airflow/.local/lib/python3.11/site-packages/airflow/sdk/definitions/param.py", line 242 in validate

What you think should happen instead?

Airflow should allow DAGs with params lacking explicit defaults to import, as in earlier versions. This validation should not prevent import for HITLOperator and similar uses.

How to reproduce

  1. Create a DAG with a HITLOperator and a param without a default (e.g. params={"my_param": Param(type="string")})
  2. Place the DAG in the dags folder for Airflow 3.1.5
  3. Import will fail with ParamValidationError on the missing default value
  4. This does not occur in older Airflow versions

Operating System

Debian based, official docker image

Versions of Apache Airflow Providers

No response

Deployment

Other Docker-based deployment

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

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions