# Error Handling

The `errorHandling` configuration block provides fine-grained control over the replicator's fault-tolerance behavior. It allows you to define how K2K should respond to specific, non-terminal error conditions encountered during its internal operations.

* **`fail` (Default):** Implements a fail-fast strategy by stopping the K2K task immediately upon error detection and reporting a failure. This approach prevents further data inconsistency and requires operator intervention or an external orchestration system to restart the task. It is considered the safest and is generally recommended for most scenarios.
* **`ignore`:** Logs the error and allows the K2K task to continue operation. While this may improve availability for transient issues, it should be used with caution. Ignoring persistent errors can lead to an unpredictable application state or obscure serious underlying problems.

| Property                               | Description                                                                                                                                                                                           | Options          | Default |
| -------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------- | ------- |
| `onCommitSyncTimeout`                  | Defines the behavior when a timeout occurs while K2K is trying to determine the latest committed offset from its internal coordination topic.                                                         | `fail`, `ignore` | `fail`  |
| `onControlMessageDeserializationError` | Defines the behavior when a message on one of K2K's internal topics (e.g., `__k2k-assignment`) cannot be deserialized. This can indicate data corruption or a version mismatch between K2K instances. | `fail`, `ignore` | `fail`  |

The following example configures the replicator to ignore commit sync timeouts while retaining the default fail-fast behavior for deserialization errors.

```yaml
# ---------------------------------------------------
# K2K Error Handling Configuration
# ---------------------------------------------------
errorHandling:
  # This configuration sets the replicator to continue operating even if it
  # temporarily fails to determine its latest committed offset.
  # WARNING: Use 'ignore' with caution as it may mask underlying issues.
  onCommitSyncTimeout: ignore

  # The replicator will use the default behavior ('fail') for this error type,
  # as it is not specified.
  # onControlMessageDeserializationError: fail
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.lenses.io/latest/k2k/configuration/error-handling.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
