cuddly-jelly-27016
05/29/2025, 3:07 PMis_none() throws an error when trying to evaluate if an indexed list item is None inside of a conditional.
The error below is reproducible from the code excerpt in the additional context.
AttributeError: 'NoneType' object has no attribute 'union'
This error is caused from a much more complex pipeline that is doing the same thing:
Error 0: Code: ValueRequired, Node Id: n1, Description: Value required [RightValue.Val].
### Expected behavior
Lists with None values should be able to be evaluated without typing or attribute issues.
### Additional context to reproduce
from typing import Optional, Union
from flytekit import conditional, task, workflow
@task
def check_status() -> list[Optional[bool]]:
return [None, True]
@task
def success_task() -> str:
return "Task succeeded"
@task
def failure_task() -> str:
return "Task failed"
@workflow
def wf() -> Optional[Union[str, bool]]:
status = check_status()[0]
return (
conditional("status_check")
.if_(status.is_none())
.then(success_task())
.else_()
.then(failure_task())
)
if __name__ == '__main__':
result = wf()
print(result)
### Screenshots
No response
### Are you sure this issue hasn't been raised already?
• Yes
### Have you read the Code of Conduct?
• Yes
flyteorg/flyte