#3388·metaflow

@trigger with a deploy-time function of the wrong type raises TypeError: unhashable type: 'list' instead of ParameterFieldTypeMismatch

Author: kevin9327Created Sep 28, 2026Updated Sep 28, 2026

Summary

When a deploy-time function given to @trigger or @trigger_on_finish returns a value of the wrong type, the user sees TypeError: unhashable type: 'list' raised from inside Metaflow instead of the ParameterFieldTypeMismatch that says which types were expected.

Runtime

Deploy time: argo-workflows create, step-functions create, or any deploy_time_eval of the decorator attributes. The failure happens while the error message is built, before any orchestrator call, so it is the same everywhere.

Reproduction

python
import metaflow.parameters as P
from metaflow.parameters import DeployTimeField, ParameterContext

P.context_proto = ParameterContext(
    flow_name="TriggerFlow", user_name="tester", parameter_name=None,
    logger=print, ds_type="local", configs=None,
)

# as metaflow/plugins/events_decorator.py builds it for @trigger(event=<fn>)
f = DeployTimeField("event", [str, dict], None, lambda ctx, dt: 42, False)
try:
    f(deploy_time=True)
except Exception as e:
    print("RAISED: %s -> %s" % (type(e).__name__, e))

Observed on master:

RAISED: TypeError -> unhashable type: 'list'

The same happens for @trigger(event={"parameters": <fn>}) ([list, dict, tuple]) and @trigger_on_finish(flow=<fn>) ([str, dict]).

Expected

RAISED: ParameterFieldTypeMismatch -> The value returned by the deploy-time function for the parameter *event* field *None* has a wrong type. Expected one of the following str, dict.

Cause

In metaflow/parameters.py, DeployTimeField._check_type handles a list-typed field with "Expected one of the following %s." % TYPES[self.parameter_type]. That branch runs only when parameter_type is a list, and a list cannot be a dict key, so building the message raises TypeError and ParameterFieldTypeMismatch is never raised. TYPES also has no str entry, so [str, dict] could not be rendered from it anyway.

Fix proposed in #3370 (render one name per listed type, falling back to __name__).