acoustic-carpenter-78188
03/31/2026, 12:17 AMk in this code will always refer to the final arg, even if that's not where the error occurred.
To reproduce, run
from flytekit import task, workflow
from flytekit.types.directory import FlyteDirectory
@task
def process_directory(input_dir: FlyteDirectory, description: str) -> str:
"""Process a directory with a description."""
return f"Processing directory: {input_dir.path} with description: {description}"
@workflow
def main_workflow(input_dir: FlyteDirectory, description: str) -> str:
"""Main workflow that calls the task."""
return process_directory(input_dir=input_dir, description=description)
if name == "__main__":
# Incorrectly passing empty string as first argument (should be FlyteDirectory)
result = main_workflow(input_dir=FlyteDirectory(""), description="Sample processing job")
print(result)
which will give the unhelpful errormessage:
TypeTransformerFailedError: Error encountered while converting inputs of 'example_flyte_task.process_directory':
Error converting input 'description' at position 1:
Literal value: Flyte Serialized object (Literal):
scalar:
primitive:
string_value: Sample processing job
Expected Python type: <class 'str'>
Exception: USER:AssertionError: error=Expected a directory, but the given uri '' is not a directory.
Expected behavior
I'd expect an error message like the following (achieved by removing the 2nd arg):
TypeTransformerFailedError: Error encountered while converting inputs of 'example_flyte_task.process_directory':
Error converting input 'input_dir' at position 0:
Literal value: Flyte Serialized object (Literal):
scalar:
blob:
metadata:
type:
dimensionality: 1
Expected Python type: <class 'flytekit.types.directory.types.FlyteDirectory'>
Exception: USER:AssertionError: error=Expected a directory, but the given uri '' is not a directory.
Additional context to reproduce
No response
Screenshots
No response
Are you sure this issue hasn't been raised already?
• Yes
Have you read the Code of Conduct?
• Yes
flyteorg/flyteacoustic-carpenter-78188
03/31/2026, 12:17 AM