cuddly-jelly-27016
05/31/2025, 12:10 AMfrom flytekit import workflow
@workflow
def mywf(first=str, second=str):
...
instead of
from flytekit import workflow
@workflow
def mywf(first:str, second:str):
....
Here's the stacktrace
:
Failed with Unknown Exception <class 'TypeError'> Reason: isinstance() arg 2 must be a type, a tuple of types, or a union
Traceback:
File "<<root>>/envs/flyte/lib/python3.10/site-packages/flytekit/clis/sdk_in_container/utils.py", line 139, in invoke
return super().invoke(ctx)
File "<<root>>/envs/flyte/lib/python3.10/site-packages/click/core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "<<root>>/envs/flyte/lib/python3.10/site-packages/click/core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "<<root>>/envs/flyte/lib/python3.10/site-packages/click/core.py", line 783, in invoke
return __callback(*args, **kwargs)
File "<<root>>/envs/flyte/lib/python3.10/site-packages/click/decorators.py", line 33, in new_func
return f(get_current_context(), *args, **kwargs)
File "<<root>>/envs/flyte/lib/python3.10/site-packages/flytekit/clis/sdk_in_container/register.py", line 202, in register
raise e
File "<<root>>/envs/flyte/lib/python3.10/site-packages/flytekit/clis/sdk_in_container/register.py", line 183, in register
repo.register(
File "<<root>>/envs/flyte/lib/python3.10/site-packages/flytekit/tools/repo.py", line 264, in register
registrable_entities = load_packages_and_modules(
File "<<root>>envs/flyte/lib/python3.10/site-packages/flytekit/tools/repo.py", line 183, in load_packages_and_modules
registrable_entities = serialize(pkgs_and_modules, ss, str(project_root), options)
File "<<root>>/envs/flyte/lib/python3.10/site-packages/flytekit/tools/repo.py", line 48, in serialize
registrable_entities = get_registrable_entities(ctx, options=options)
File "<<root>>/envs/flyte/lib/python3.10/site-packages/flytekit/tools/serialize_helpers.py", line 60, in get_registrable_entities
lp = LaunchPlan.get_default_launch_plan(ctx, entity)
File "<<root>>/envs/flyte/lib/python3.10/site-packages/flytekit/core/launch_plan.py", line 93, in get_default_launch_plan
parameter_map = transform_inputs_to_parameters(ctx, workflow.python_interface)
File "<<root>>/envs/flyte/lib/python3.10/site-packages/flytekit/core/interface.py", line 233, in transform_inputs_to_parameters
default_lv = TypeEngine.to_literal(ctx, _default, python_type=interface.inputs[k], expected=v.type)
File "<<root>>/envs/flyte/lib/python3.10/site-packages/flytekit/core/type_engine.py", line 1111, in to_literal
transformer.assert_type(python_type, python_val)
File "<<root>>/envs/flyte/lib/python3.10/site-packages/flytekit/core/type_engine.py", line 154, in assert_type
if not hasattr(t, "__origin__") and not isinstance(v, t):
isinstance() arg 2 must be a type, a tuple of types, or a union
### Expected behavior
It would have been helpful if the stacktrace had contained:
• the line of my workflow file which it caused it to error
• a clearer error message (e.g. TypeAnnotation missing for input X of workflow/task Y or no Type found for input X of workflow/task Y)
### Additional context to reproduce
See code examples above
### Screenshots
No response
### Are you sure this issue hasn't been raised already?
• Yes
### Have you read the Code of Conduct?
• Yes
flyteorg/flytecuddly-jelly-27016
05/31/2025, 12:10 AM