Skip to content

[26.0] Fix AssertionError remapping malformed galaxy markdown blocks#23176

Open
mvdbeek wants to merge 1 commit into
galaxyproject:release_26.0from
mvdbeek:issue-23175-assertionerror
Open

[26.0] Fix AssertionError remapping malformed galaxy markdown blocks#23176
mvdbeek wants to merge 1 commit into
galaxyproject:release_26.0from
mvdbeek:issue-23175-assertionerror

Conversation

@mvdbeek

@mvdbeek mvdbeek commented Jul 24, 2026

Copy link
Copy Markdown
Member

_remap_container (in _remap_galaxy_markdown_calls) saved the directive line while looping over a ```galaxy container's lines, but then re-matched GALAXY_MARKDOWN_FUNCTION_CALL_LINE against the loop variable holding the container's last line. For stored report markdown that was never validated — e.g. an unclosed ```galaxy fence, which makes GALAXY_FENCED_BLOCK swallow the following prose into the container — the re-match returned None and the subsequent assert produced an unhandled 500 on GET /api/invocations/{invocation_id}/report.

Sentry captured the failing locals directly (9 occurrences on usegalaxy.eu 26.1.rc1): matching_line held the directive history_dataset_as_image(output="spatial scatter plots filtered") while line was <br>, so match was None.

This keeps the match object found during the loop instead of re-matching, and turns the other assert (a second directive within one block) into MalformedContents so malformed user content yields a 4xx rather than an AssertionError.

Fixes #23175
Fixes USEGALAXY-EU-MAIN-61HFG00001W43

How to test the changes?

License

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

_remap_container saved the directive line while looping over the
container's lines, but then re-matched GALAXY_MARKDOWN_FUNCTION_CALL_LINE
against the loop variable holding the container's *last* line. For stored
report markdown that was never validated (e.g. an unclosed ```galaxy
fence swallowing following prose), the re-match returned None and the
subsequent assert produced an unhandled 500 on
GET /api/invocations/{invocation_id}/report.

Keep the match object found in the loop instead, and turn the assert on
a second directive within one block into MalformedContents so malformed
user content yields a 4xx rather than an AssertionError.

Fixes galaxyproject#23175
Fixes USEGALAXY-EU-MAIN-61HFG00001W43
@github-actions github-actions Bot changed the title Fix AssertionError remapping malformed galaxy markdown blocks [26.0] Fix AssertionError remapping malformed galaxy markdown blocks Jul 24, 2026
@github-actions github-actions Bot added this to the 26.2 milestone Jul 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Needs Review

Development

Successfully merging this pull request may close these issues.

1 participant