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

# Runner could not finish the task before shutdown

> Resolve the error returned when a task is still running as the Maia runner starts shutting down.

## Error message

```text wrap theme={null}
Runner could not finish processing task before a shut down occurred
```

This error can appear when using the following components: [Database Query](https://docs.maia.ai/docs/components/database-query.md), [Python Script](https://docs.maia.ai/docs/components/python-script.md), [SQL Script](https://docs.maia.ai/docs/components/sql-script.md), and [transformation components](https://docs.maia.ai/docs/components/transformation-pipeline-overview.md).

### Explanation

A task was running when the Maia runner started shutting down, and the task didn't complete in time.

### Potential causes

* The Maia runner was restarted, redeployed, or scaled in while the component was still running.
* The component needed longer to finish than the shutdown grace period allows.

***

## Resolve the error

1. Check for a deployment, restart, or scale-in event on the Maia runner at the time of the failure.
2. Increase the shutdown grace period to cover your longest-running components.
3. [Pause schedules](https://docs.maia.ai/docs/guides/schedules.md) or wait for running pipelines to finish before restarting the Maia runner.
4. Re-run the pipeline.
5. If you still need help, [contact Maia Support](https://support.matillion.com/s/) and include the items listed below.

   * The full error text.
   * The root pipeline execution ID.
   * The Maia runner ID and the time of failure (UTC).

### Prevent future errors

To prevent this error occurring again:

* Split very long-running work into smaller components so each one completes within the grace period.
* [Run several instances](https://docs.maia.ai/docs/guides/scaling-best-practices.md#maia-runner-instances) and update them one at a time.


## Related topics

- [Runner instance stopped before it could shut down gracefully](https://docs.maia.ai/docs/errors/runner-instance-stopped-before-it-could-shut-down-gracefully.md)
- [Shutdown in progress](https://docs.maia.ai/docs/errors/shutdown-in-progress.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.