<#1921 Improve error message when omitting task kw...
# flyte-github
a
#1921 Improve error message when omitting task kwarg in workflows Pull request opened by fg91 TL;DR Improve error message when, in a workflow, one omits to pass an optional kwarg to a task. * * * In python, the following is perfectly valid:
Copy code
def foo(bar: int=1) -> int:
    return bar

def wf() -> int:
    return foo()
In Flyte, the following workflow (which only adds task/workflow decorators) is not:
Copy code
@task
def foo(bar: int=1) -> int:
    return bar


@workflow
def wf() -> int:
    return foo()
The user is confronted with this error message:
Copy code
flytekit.exceptions.user.FlyteAssertion: Error encountered while executing 'wf':
  Input was not specified for: bar of type <FlyteLiteral simple: INTEGER>
Many Flyte users are ML engineers that are not necessarily aware of the following (source):
Although Flyte workflow syntax looks like Python code, it’s actually a domain-specific language (DSL) for building execution graphs where tasks – and other workflows – serve as the building blocks. This means that the workflow function body only supports a subset of Python’s semantics
For these users, the above error message is very confusing and does not give a hint why something that works in python wouldn't work in a flyte workflow. * * * Since I was asked about this particular limitation by several of our platform users, I propose that we improve the error message so that the error explains itself and users are informed about flyte workflows being a DSL, not python. Type Neither of the following but improved error message. ☐ Bug Fix ☐ Feature ☐ Plugin Are all requirements met? ☑︎ Code completed ☑︎ Smoke tested ☐ Unit tests added ☐ Code documentation added ☐ Any pending items have an associated Issue Complete description NA Tracking Issue NA Follow-up issue NA flyteorg/flytekit Codecov: 0.00% of diff hit (target 54.71%) ✅ 29 other checks have passed 29/30 successful checks