cuddly-jelly-27016
05/23/2025, 12:09 AM@dynamic
def dyn_optional_str(optional_str: Optional[str]) -> Optional[str]:
return None
@workflow
def workflow_with_optional_input(optional_str: Optional[str]) -> Optional[str]:
hello_output = dyn_optional_str(optional_str=optional_str)
return hello_output
and test was done like this
def test_example() -> None:
result = workflow_with_optional_input(optional_str=None)
assert result is None
and it crashes with this error
except Exception as e:
logger.error(f"Failed to convert return value for var {k} with error {type(e)}: {e}")
> raise TypeError(
f"Failed to convert return value for var {k} for function {self.name} with error {type(e)}: {e}"
) from e
E TypeError: Failed to convert return value for var o0 for function sandbox.dynamic_optional_type.dyn_optional_str with error <class 'AssertionError'>: Task sandbox.dynamic_optional_type.dyn_optional_str returns nothing, NoneType return cannot be used
/fn/lib/venv/lib/python3.10/site-packages/flytekit/core/base_task.py:572: TypeError
### Expected behavior
Local execution should finish successfully and return None.
### 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/flytecuddly-jelly-27016
05/23/2025, 12:09 AM