> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pipecat.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Exceptions

> Error types for task coordination

## TaskError

```python theme={null}
from pipecat_subagents.agents.task_context import TaskError
```

Raised when a single-agent task (via [`TaskContext`](/api-reference/pipecat-subagents/types#taskcontext)) is cancelled due to a worker error or timeout.

```python theme={null}
try:
    async with self.task("worker", payload=data, timeout=30) as t:
        async for event in t:
            ...
    print(t.response)
except TaskError as e:
    print(f"Task failed: {e}")
```

## TaskGroupError

```python theme={null}
from pipecat_subagents.agents.task_context import TaskGroupError
```

Raised when a task group (via [`TaskGroupContext`](/api-reference/pipecat-subagents/types#taskgroupcontext)) is cancelled due to a worker error or timeout. Also raised if agents are not ready within the specified timeout.

```python theme={null}
try:
    async with self.task_group("w1", "w2", payload=data, timeout=30) as tg:
        async for event in tg:
            ...
    print(tg.responses)
except TaskGroupError as e:
    print(f"Task group failed: {e}")
```
