<#4301 [BUG] @task decorator function that returns...
# flytekit
c
#4301 [BUG] @task decorator function that returns -&gt; ValueError | FlyteFile[Any] causes a silent failure of the FlyteFile job Issue created by ssriram1978 ### Describe the bug Let's take this task decorator as an example:
Copy code
@task
def create_global_model_artifact(
    B_variants: Dict, name: str
) -> ValueError | FlyteFile[Any]:
    klass = GLOBAL_MODELS.get(name, None)

    if klass is None:
        return ValueError(
            f"No model named {name} exists. Valid options: {list(MODELS.keys())} "
        )

    model = klass(B_variants=B_variants)

    output = package_tfmodel_for_sagemaker(model, signatures={name: model.__call__})

    return FlyteFile(path=output)
Here this task is failing silently with WARNING:
Copy code
2023-10-25 15:27:16,950 [INFO] botocore.credentials - Found credentials from IAM Role: dcp-cd-recs-databricks-instance-profile
{"asctime": "2023-10-25 15:27:17,115", "name": "flytekit", "levelname": "WARNING", "message": "Unsupported Type ValueError | flytekit.types.file.file.FlyteFile.__class_getitem__.<locals>._SpecificFormatClass found, Flyte will default to use PickleFile as the transport. Pickle can only be used to send objects between the exact same version of Python, and we strongly recommend to use python type that flyte support."}
### Expected behavior The task should not fail and the Flyte job should succeed. ### 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