Fail job gracefully when output name exceeds 255 character DB limit

When discovered dataset designations are very long (e.g., taxonomic names),
the job output association name (__new_primary_file_{name}|{designation}__)
can exceed the VARCHAR(255) column limit, causing StringDataRightTruncation
which corrupts the SQLAlchemy session and triggers PendingRollbackError.

Add name length validation in Job.add_output_dataset and related methods
that raises ValueError before the DB INSERT. Catch the error in both the
normal and extended metadata code paths to fail the job with a clear error
message instead of crashing the transaction session.

Fixes https://github.com/galaxyproject/galaxy/issues/22045
This commit is contained in:
Marius van den Beek
2026-04-03 11:26:38 +02:00
committed by mvdbeek
parent d3b040e17d
commit f820d570be
8 changed files with 106 additions and 5 deletions
@@ -0,0 +1,13 @@
<tool id="discover_long_name" name="discover_long_name" version="0.1.0" profile="20.09">
<command><![CDATA[
echo "data" > '${output_name}.txt'
]]></command>
<inputs>
<param name="output_name" type="text" label="Output name" />
</inputs>
<outputs>
<data format="txt" name="output">
<discover_datasets pattern="__name_and_ext__" visible="true" />
</data>
</outputs>
</tool>
@@ -219,6 +219,7 @@
<tool file="collection_paired_or_unpaired.xml" />
<tool file="collection_list_paired_or_unpaired.xml" />
<tool file="discover_sort_by.xml" />
<tool file="discover_long_name.xml" />
<tool file="discover_default_ext.xml" />
<tool file="expression_forty_two.xml" />
<tool file="expression_pick_larger_file.xml" />