<#6639 [BUG] [flytekit] Bug in list of basemodels ...
# flyte-github
a
#6639 [BUG] [flytekit] Bug in list of basemodels type conversion Issue created by pimdh Flyte & Flytekit version flytekit 1.16.3 Describe the bug from flytekit import workflow, task from pydantic import BaseModel class M(BaseModel): pass class C(BaseModel): xs: list[M] = [] @task def f(x: list[M]) -> None: print(x) @task def z() -> C: return C() @workflow def d() -> None: f(z().xs) if name == "__main__": d() Running gives error:
Copy code
TypeTransformerFailedError: Error encountered while executing 'bug.d':
  Error encountered while converting inputs of 'bug.f':
  Error converting input 'x' at position 0:
Literal value: Flyte Serialized object (Literal):
  scalar:
    binary:
      value: b'\x90'
      tag: msgpack
Expected Python type: list[__main__.M]
Exception: Field "" of type M in __root__ is not serializable
Expected behavior I'd expect that code to work without failure and print an empty list. It has something to do with the fact that the
z().xs
gives a literal scalar containing msgpack of a list of dicts. If I'd have done def d(): f(C()) then the literal given to
f
is instead a literal of a collection of msgpacks of a dict. This is handled correctly by the type engine. 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/flyte