Skip to content

Task details not available in the UI when using subflow output as input to a task ("Invalid TaskInputResponse" in browser console) #18680

@fohrloop

Description

@fohrloop

Bug summary

Compete MWE reproducing the issue

import time
from pathlib import Path

from prefect import flow, task


@flow
def mainflow() -> None:
    folder = Path(".") / "data"
    outfiles = fetch_data(folder)
    another_task(outfiles["a"])


@flow
def fetch_data(folder: Path) -> dict[str, Path]:
    sql_queries = ["a", "b", "c"]
    time.sleep(1)
    outfiles = {x: Path(x) for x in sql_queries}
    return outfiles


@task
def another_task(
    input_file: Path,
) -> None:
    time.sleep(1)


if __name__ == "__main__":
    mainflow()
Image

This is what you see in the console

Image

Workaround 1: Do not use subflows

If you change the fetch_data (subflow) in to a @task, everything works as expected:

import time
from pathlib import Path

from prefect import flow, task


@flow
def mainflow() -> None:
    folder = Path(".") / "data"
    outfiles = fetch_data(folder)
    another_task(outfiles["a"])


@task # This changed from @flow to @task
def fetch_data(folder: Path) -> dict[str, Path]:
    sql_queries = ["a", "b", "c"]
    time.sleep(1)
    outfiles = {x: Path(x) for x in sql_queries}
    return outfiles


@task
def another_task(
    input_file: Path,
) -> None:
    time.sleep(1)


if __name__ == "__main__":
    mainflow()
Image

Workaround 2

If you don't use the output from the subflow as an argument to the task, everything works as expected:

import time
from pathlib import Path

from prefect import flow, task


@flow
def mainflow() -> None:
    folder = Path(".") / "data"
    _ = fetch_data(folder)
    another_task(folder / "input.txt") # This input changed


@flow
def fetch_data(folder: Path) -> dict[str, Path]:
    sql_queries = ["a", "b", "c"]
    time.sleep(1)
    outfiles = {x: Path(x) for x in sql_queries}
    return outfiles


@task
def another_task(
    input_file: Path,
) -> None:
    time.sleep(1)


if __name__ == "__main__":
    mainflow()
Image

Version info

Version:             3.4.11
API version:         0.8.4
Python version:      3.12.10
Git commit:          3c98aa7f
Built:               Thu, Jul 31, 2025 08:45 PM
OS/Arch:             linux/x86_64
Profile:             local
Server type:         server
Pydantic version:    2.11.7

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions