# Moose / Workflows / Retries And Timeouts Documentation – TypeScript ## Included Files 1. moose/workflows/retries-and-timeouts/retries-and-timeouts.mdx ## retries-and-timeouts Source: moose/workflows/retries-and-timeouts/retries-and-timeouts.mdx # Error Detection and Handling Moose provides multiple layers of error protection, both at the workflow and task level: ### Workflow-Level Retries and Timeouts Moose automatically catches any runtime errors during workflow execution. Errors are logged for debugging, and the orchestrator will retry failed tasks according to the `retries` option. In your `Workflow`, you can configure the following options to control workflow behavior, including timeouts and retries: ```typescript filename="app/index.ts" {5,6} copy ); ``` ### Task-Level Errors and Retries For more granular control over task-level errors and retries, you can configure your individual tasks to have their own retry behavior. For workflows & tasks that may not have a predefined timeout, you may set `never` as the timeout. ```typescript filename="app/index.ts" {5-6} copy ); ); ``` ### Example: Workflow and Task Retry Interplay When configuring retries, it's important to understand how workflow-level and task-level retries interact. Consider the following scenario: - **Workflow Retry Policy**: 2 attempts - **Task Retry Policy**: 3 attempts ```typescript filename="app/index.ts" {5,10} copy ); ); ``` If the execution of the workflow encounters an error, the retry sequence would proceed as follows: 1. **Workflow Attempt 1** - **Task Attempt 1**: Task fails - **Task Attempt 2**: Task fails - **Task Attempt 3**: Task fails - Workflow attempt fails after exhausting task retries 2. **Workflow Attempt 2** - **Task Attempt 1**: Task fails - **Task Attempt 2**: Task fails - **Task Attempt 3**: Task fails - Workflow attempt fails after exhausting task retries In this example, the workflow will make a total of 2 attempts, and each task within those attempts will retry up to 3 times before the workflow itself retries.