Skip to content

[26.0] Raise error when API client sends invalid parameter keys#22277

Merged
mvdbeek merged 2 commits intogalaxyproject:release_26.0from
mvdbeek:raise-exception-invalid-param
Mar 28, 2026
Merged

[26.0] Raise error when API client sends invalid parameter keys#22277
mvdbeek merged 2 commits intogalaxyproject:release_26.0from
mvdbeek:raise-exception-invalid-param

Conversation

@mvdbeek
Copy link
Copy Markdown
Member

@mvdbeek mvdbeek commented Mar 27, 2026

The Sentry crash (issue #22132) was triggered by a Python Requests 2.32
client sending an invalid payload.

In this case the input was

{
  "in": "custom",

  "in|custom|mtx": {
    "id": "f9cad7b01a472135e9dd0bb539e2d0de",
    "src": "hda"
  },

  "in|custom|obs": {
    "id": "f9cad7b01a472135068f117b3249ac19",
    "src": "hda"
  },

  "in|custom|var": {
    "id": "f9cad7b01a472135e497326e87a7fa84",
    "src": "hda"
  }
}

where in is a conditional and adata_format is the tester select that
you can in fact set to custom.

Replace the opaque AttributeError with a RequestParameterInvalidException
that tells the caller exactly what went wrong and how to fix their
parameter naming.

Fixes #22132

Not adding tests here, I suppose that'll be fixed and covered once we validate against the tool state.

How to test the changes?

(Select all options that apply)

  • I've included appropriate automated tests.
  • This is a refactoring of components with existing test coverage.
  • Instructions for manual testing are as follows:
    1. [add testing steps and prerequisites here if you didn't write automated tests covering all your changes]

License

  • I agree to license these and all my past contributions to the core galaxy codebase under the MIT license.

The Sentry crash (issue galaxyproject#22132) was triggered by a Python Requests 2.32
client sending an invalid payload.

In this case the input was
```json
{
  "in": "custom",

  "in|custom|mtx": {
    "id": "f9cad7b01a472135e9dd0bb539e2d0de",
    "src": "hda"
  },

  "in|custom|obs": {
    "id": "f9cad7b01a472135068f117b3249ac19",
    "src": "hda"
  },

  "in|custom|var": {
    "id": "f9cad7b01a472135e497326e87a7fa84",
    "src": "hda"
  }
}
```
where `in` is a conditional and `adata_format` is the tester select that
you can in fact set to `custom`.

Replace the opaque AttributeError with a RequestParameterInvalidException
that tells the caller exactly what went wrong and how to fix their
parameter naming.

Fixes galaxyproject#22132
@mvdbeek mvdbeek force-pushed the raise-exception-invalid-param branch from d9b12b8 to ec0df9d Compare March 27, 2026 11:14
@github-actions github-actions Bot added this to the 26.1 milestone Mar 27, 2026
@github-actions github-actions Bot changed the title Raise error when API client sends invalid parameter keys [26.0] Raise error when API client sends invalid parameter keys Mar 27, 2026
Comment thread lib/galaxy/tools/parameters/wrapped.py Outdated
f"but '{input_name}' was already assigned the plain value {subdict}. "
f"Use the full prefixed parameter name (e.g. '<conditional_name>|<input_name>') "
f"instead of the unprefixed input name."
)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It says in the comment above this could be a section and not just a conditional. Also - where is the evidence that this is how subdict became not a subdict. It feel likes Claude walking one potential value through the logic and hitting one kind of error and then generalizing. I'm fine with replacing the error type but this error message feels wrong or unsupported to me. Maybe if I spend more time with it - I would feel differently though.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It says in the comment above this could be a section and not just a conditional. Also - where is the evidence that this is how subdict became not a subdict.

The payload is in the PR description, I deleted the unit test that seemed like nonsense. I did struggle finding a better message here. Yes, it doesn't need to be a conditional, any invalid parameter that conflicts with a valid input is going to fail this.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I assume validating against the schema is going to solve that problem entirely so I thought we can let that one slide 😆

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Scene cut to how that work is going 😭😭😓...

Screenshot 2026-03-27 at 10 32 52 AM

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I mean i don't have all the context but this doesn't seem to be entirely right ?
Screenshot 2026-03-27 at 18 21 59

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The context is totally unrelated I just wanted to scream into the void - it is workflow state - how we do the maybe it is encoded or not thing - I don't know how it could be consistent but hopefully I'll prove myself wrong.

@mvdbeek mvdbeek merged commit 8e6f07b into galaxyproject:release_26.0 Mar 28, 2026
51 of 55 checks passed
@github-project-automation github-project-automation Bot moved this from Needs Review to Done in Galaxy Dev - weeklies Mar 28, 2026
@ahmedhamidawan ahmedhamidawan modified the milestones: 26.1, 26.0 Mar 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Development

Successfully merging this pull request may close these issues.

3 participants