Skip to content

Instantly share code, notes, and snippets.

@dannon
Created March 17, 2026 11:02
Show Gist options
  • Select an option

  • Save dannon/8439dd2a175fe08dbeba2729713fffc8 to your computer and use it in GitHub Desktop.

Select an option

Save dannon/8439dd2a175fe08dbeba2729713fffc8 to your computer and use it in GitHub Desktop.

Triage: #22132 — AttributeError: 'str' object has no attribute 'get'

Classification: Bug

NOT a duplicate of #22019. The two issues have completely different stack traces and affect different subsystems:

  • #22019: histories.pyget_record_metadata() — export metadata stored as string instead of dict
  • #22132: tools/parameters/wrapped.pyprocess_key() — tool parameter flattening/nesting

Root Cause Analysis

The process_key() function in lib/galaxy/tools/parameters/wrapped.py (line 203) converts flat pipe-delimited tool parameters into nested dicts. On line 191, it stores scalar values (d[incoming_key] = incoming_value). On line 203, it assumes d.get(input_name, {}) will return a dict, but if a previous iteration already stored a string at that key, the .get() returns the string, and the recursive call on line 205 then crashes trying to call .get() on that string.

This only affects the input_format == legacy path (flat parameter encoding), so it is likely triggered by specific tool parameter structures submitted through the older API format — possibly a conditional or section where the flat key ordering creates a conflict between a scalar value and a nested key sharing the same prefix.

Recommendation

Add a type guard in process_key at line 203: if d.get(input_name) returns a non-dict value, replace it with a fresh {} (or wrap the existing value) before recursing. Small, isolated fix in lib/galaxy/tools/parameters/wrapped.py. Worth checking what specific tool/parameters triggered this on the production instance (via Sentry) to understand if there is a broader issue with how certain tool inputs get flattened.

Effort Estimate

Small

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