galaxyproject / galaxy

Data intensive science for everyone.
https://galaxyproject.org
Other
1.41k stars 1.01k forks source link

switching tool versions in workflow yields 500 #17464

Closed martenson closed 7 months ago

martenson commented 9 months ago

The error is triggered by switching between 0.0.3+galaxy1 and 0.0.3+galaxy2 for iuc/pretext_snapshot. Reproducible on Main.

Caused by a tool parameter changing its type between versions.

galaxy.web.framework.decorators ERROR 2024-02-13 13:24:08,594 [pN:main.1,p:5280,tN:WSGI_2] Uncaught exception in exposed API method:
Traceback (most recent call last):
  File "/Users/marten/devel/git/galaxy/lib/galaxy/web/framework/decorators.py", line 346, in decorator
    rval = func(self, trans, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/marten/devel/git/galaxy/lib/galaxy/webapps/galaxy/api/workflows.py", line 595, in build_module
    "tool_state": module.get_state(),
                  ^^^^^^^^^^^^^^^^^^
  File "/Users/marten/devel/git/galaxy/lib/galaxy/workflow/modules.py", line 319, in get_state
    return self.state.encode(Bunch(inputs=inputs), self.trans.app, nested=nested)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/marten/devel/git/galaxy/lib/galaxy/tools/__init__.py", line 696, in encode
    value = params_to_strings(tool.inputs, self.inputs, app, nested=nested)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/marten/devel/git/galaxy/lib/galaxy/tools/parameters/__init__.py", line 266, in params_to_strings
    value = params[key].value_to_basic(value, app, use_security=use_security)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/marten/devel/git/galaxy/lib/galaxy/tools/parameters/grouping.py", line 753, in value_to_basic
    current_case = rval["__current_case__"] = self.get_current_case(value[self.test_param.name])
                                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/marten/devel/git/galaxy/lib/galaxy/tools/parameters/grouping.py", line 746, in get_current_case
    raise ValueError("No case matched value:", self.name, str_value)
ValueError: ('No case matched value:', 'grid', 'False')
uvicorn.access INFO 2024-02-13 13:24:08,596 [pN:main.1,p:5280,tN:MainThread] 127.0.0.1:54934 - "POST /api/workflows/build_module HTTP/1.1" 500

Galaxy Version and/or server at which you observed the bug Galaxy Version: dev Commit: be90acce3afff88c3c991a638251d4cf820cc0e2

cc @Delphine-L -- original reporter

martenson commented 9 months ago

oh, this is actually likely a tool error

tool seems fine, this has likely to do with the following change between the tool versions, I assume that when you are updating the tool in the workflow this is not handled correctly

 <conditional name="grid">
-            <param name="showGrid" label="Show grid?" type="boolean" truevalue="yes" falsevalue="no"/>
+            <param name="showGrid" label="Show grid?" type="select">
+                <option value="no">No</option>
+                <option value="yes">Yes</option>
+            </param>
martenson commented 9 months ago

The workaround is delete and re-add the node. Galaxy could be more resilient when params are missing or changed in a non-compatible manner. Or at least fail gracefully -- in the end these are two valid tool versions.

martenson commented 9 months ago

cc @astrovsky01

mvdbeek commented 7 months ago

Fixed in https://github.com/galaxyproject/galaxy/pull/17858