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

# Repairs and regeneration

> How Lark fixes and rebuilds deterministic workflow scripts.

Repairs and regeneration apply to **scripted workflows only**. AI-driven workflows have no stored script to fix or rebuild.

## Repair

A repair fixes a scripted workflow's test script when it breaks. This happens when your product changes in a way the existing script can't handle (a renamed element, a changed flow, a new step).

### Auto-repair

Lark can repair workflows on its own. After a scripted workflow's execution fails, Lark first runs [summarization](/workflow-lifecycle#summarization) to decide whether the script is at fault. If the failure is classified as a `test_issue` and auto-repair is enabled for your account, Lark kicks off a repair. Failures classified as `app_issue` (real product regressions) leave the workflow `active` and skip the repair.

Auto-repair is an account-level setting. You can enable or disable it in the [dashboard](https://dashboard.getlark.ai/settings/workflows).

### Manual repair

Trigger a repair from the dashboard or the API:

Navigate to the workflow in the [dashboard](https://dashboard.getlark.ai/workflows) and click **Repair**.

Or trigger a repair through the API:

```bash theme={null}
curl -X POST https://api.getlark.ai/workflows/wf_abc123/repair \
  -H "X-API-Key: $GETLARK_API_KEY"
```

## Regeneration

You can also regenerate a scripted workflow if you materially change the purpose of the test.

Navigate to the workflow in the [dashboard](https://dashboard.getlark.ai/workflows) and click **Regenerate** under the `⋮` menu.

```bash theme={null}
curl -X POST https://api.getlark.ai/workflows/wf_abc123/regenerate \
  -H "X-API-Key: $GETLARK_API_KEY"
```

## Repair vs. regeneration

|                              | Repair                        | Regeneration                     |
| ---------------------------- | ----------------------------- | -------------------------------- |
| **Does what**                | Patches the existing script   | Rebuilds the script from scratch |
| **Use when**                 | A small change broke the test | The test needs a full rewrite    |
| **Can be automatic**         | Yes (auto-repair)             | No, manual only                  |
| **Preserves existing logic** | Yes, changes only what broke  | No, starts fresh                 |
