# Function extractTimeoutMs

- extractTimeoutMs(error: unknown): number | undefined

  Extracts the configured timeout duration (in ms) from a timeout-related error, if available. Returns `undefined` when the duration cannot be determined.

  Prefers structured `details.timeoutMs` metadata on `APIError(408)` (set by `baseClient.toAPIError`), falling back to regex on the error message. Recurses into `Error.cause` chains.

  #### Parameters

  - error: unknown

    A timeout-related error

  #### Returns number | undefined

  The timeout duration in milliseconds, or `undefined`

  - Defined in tools/shared/errorHandler.ts:66