Skip to content

IndexError in distributed.client.compute #9117

@andoni-garcia-fgp

Description

@andoni-garcia-fgp

Describe the issue:

I am getting IndexError: list index out of range when calling client.compute(collections). This is because expr.optimize is pruning my input collection from size 2 to a single key, which is causing and index out of bounds lookup over the names.

Minimal Complete Verifiable Example:

def test_mvp_index_out_of_bounds() -> None:
    from dask.distributed import Client as DaskClient
    from dask import delayed

    dask_client = DaskClient(processes=False, n_workers=1, threads_per_worker=1)

    pdf = pd.DataFrame({'a': [1, 2, 3]})
    ddf = dd.from_pandas(pdf, npartitions=1)

    def do_something(pdf: pd.DataFrame) -> None:
        return None

    dl = delayed(do_something)(pdf)

    futures = dask_client.compute([ddf, dl])
    results = dask_client.gather(futures)

    print(len(results))
    print(results)

Anything else we need to know?:

Environment: Pytest

$ poetry show dask
 name         : dask                                 
 version      : 2025.9.1                             
 description  : Parallel PyData with Task Scheduling 
  • Python version: 3.11.9
  • Operating System: Debian Linux
  • Install method (conda, pip, source): poetry

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething is broken

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions