<#3506 [Core feature] Improve error message when t...
# flyte-github
a
#3506 [Core feature] Improve error message when there's a type conversion error Issue created by cosmicBboy Motivation: Why do you think this is important? When the flyte compiler returns a type mismatch error, the exact task and workflows names don't appear. For example, consider the workflow:
Copy code
from flytekit import task, workflow


@task
def t1(x: int) -> int:
    return x + 1


@task
def t2(x: str) -> str:
    return str(x)


@workflow
def wf(x: int) -> str:
    out1 = t1(x=x)
    return t2(x=out1)


if __name__ == "__main__":
    print(wf(x=5))
The error:
Copy code
File "/Users/nielsbantilan/git/flytekit/flytekit/core/type_engine.py", line 185, in to_python_value
    raise TypeTransformerFailedError(f"Cannot convert literal {lv} to {self._type}")
flytekit.core.type_engine.TypeTransformerFailedError: Cannot convert literal scalar {
  primitive {
    integer: 6
  }
}
 to <class 'str'>
Goal: What should the final outcome look like, ideally? When there's a type mismatch error, identify where exactly in the workflow it's happening: • the task where the conversion failed • the input that fails conversion Describe alternatives you've considered NA Propose: Link/Inline OR Additional context No response Are you sure this issue hasn't been raised already? ☑︎ Yes Have you read the Code of Conduct? ☑︎ Yes flyteorg/flyte