Skip to content

Fix airflowctl connection create command validation error - #69317

Open
Prab-27 wants to merge 3 commits into
apache:mainfrom
Prab-27:fix-airflowctl-connection-create-command
Open

Prab-27 wants to merge 3 commits into
apache:mainfrom
Prab-27:fix-airflowctl-connection-create-command

Conversation

@Prab-27

@Prab-27 Prab-27 commented Jul 3, 2026 •

Copy link
Copy Markdown
Contributor

airflowctl connections create shows Traceback (most recent call last):

airflowctl connections create
Please enter password for encrypted keyring: 
Traceback (most recent call last):
 File "/usr/python/bin/airflowctl", line 10, in <module>
   sys.exit(main())
 File "/opt/airflow/airflow-ctl/src/airflowctl/__main__.py", line 34, in main
   safe_call_command(args.func, args=args)
 File "/opt/airflow/airflow-ctl/src/airflowctl/ctl/cli_config.py", line 77, in safe_call_command
   function(args)
 File "/opt/airflow/airflow-ctl/src/airflowctl/api/client.py", line 532, in wrapper
   return func(*args, api_client=api_client, **kwargs)
 File "/opt/airflow/airflow-ctl/src/airflowctl/ctl/cli_config.py", line 731, in _get_func
   method_params[datamodel_param_name] = datamodel.model_validate(
 File "/usr/python/lib/python3.10/site-packages/pydantic/main.py", line 732, in model_validate
   return cls.__pydantic_validator__.validate_python(
pydantic_core._pydantic_core.ValidationError: 2 validation errors for ConnectionBody
connection_id
 Input should be a valid string [type=string_type, input_value=None, input_type=NoneType]
   For further information visit https://errors.pydantic.dev/2.13/v/string_type
conn_type
 Input should be a valid string [type=string_type, input_value=None, input_type=NoneType]
   For further information visit https://errors.pydantic.dev/2.13/v/string_type

Make connection_id and conn_type as required parameter in connections operations and update tests

… tests


Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)

  • Read the Pull Request Guidelines for more information. Note: commit author/co-author name and email in commits become permanently public when merged.
  • For fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
  • When adding dependency, check compliance with the ASF 3rd Party License Policy.
  • For significant user-facing changes create newsfragment: {pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.

Important

🛠️ Maintainer triage note for @Prab-27 · by @potiuk · 2026-07-08 15:38 UTC

Helpful heads-up from the maintainers — please address before this PR can be reviewed:

  • Image build failing (Additional PROD image tests / Airflow CTL integration tests with PROD image). See the contributor guide.

Full criteria: Pull Request quality criteria.

The ball is in your court — you've been assigned to this PR. Fix the above, then mark it Ready for review.

Automated triage — may be imperfect; a maintainer takes the next look.

@SameerMesiah97 SameerMesiah97 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there are a few thing wrong with this PR (even though it looks a simple fix):

  1. Is this actually a bug? From the traceback it looks like airflowctl connections create is being invoked without the required connection information. The poor UX is the ValidationError, but I'm not convinced changing the API is the right fix for invalid input

  2. The traceback suggest execption is raised while constructing the ConnectionBody in cli_config.py, before client.connections.create() is ever called. Shouldn't the fix (if needed) live there instead?

  3. Doesn't this introduce a breaking change? Existing callers of client.connections.create() will now need to provide connection_id and conn_type explicitly.

  4. Why do connection_id and conn_type need to be separate parameters at all? They're already required fields on ConnectionBody, so this duplicates the source of truth and allows the values to diverge.

I think 1 should be addressed first. Could you provide a resproduction that illustrates that this is a genuine bug rather than due to invalid user input? I believe what might be needed here is clearer error logging that surfaces the root cause i.e. missing arguments rather a type validation error.

def create(
self,
connection: ConnectionBody,
self, connection: ConnectionBody, connection_id: str, conn_type: str

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I understand why connection_id and conn_type need to be separate required parameters here. They're already required fields on ConnectionBody, so this duplicates the source of truth and allows them to diverge. Is there a reason we can't continue deriving these values from the ConnectionBody instead?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it ! Working on it

@github-actions

Copy link
Copy Markdown
Contributor

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 5 days if no further activity occurs. Thank you for your contributions.

@github-actions github-actions Bot added the stale Stale PRs per the .github/workflows/stale.yml policy file label Aug 29, 2026
@github-actions github-actions Bot closed this Sep 3, 2026
@shahar1 shahar1 reopened this Oct 27, 2026
@shahar1 shahar1 removed the stale Stale PRs per the .github/workflows/stale.yml policy file label Oct 27, 2026
@Prab-27
Prab-27 force-pushed the fix-airflowctl-connection-create-command branch from 88e6d95 to c6e11eb Compare October 29, 2026 21:59
@Prab-27
Prab-27 force-pushed the fix-airflowctl-connection-create-command branch from c6e11eb to ddeadcf Compare October 29, 2026 22:06
@Prab-27
Prab-27 marked this pull request as draft October 29, 2026 22:08
@Prab-27
Prab-27 marked this pull request as ready for review October 29, 2026 22:15

This branch has not been deployed

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants