# crowdin api error 409 branch already exists

## TL;DR

Fixes the Crowdin API 409 when your sync creates a branch that already exists. Check for the branch first and reuse it, or delete the stale one. Use when branch creation returns 409. Not for 404s on missing projects.

## The error

```text
{"error":{"code":409,"message":"Branch already exists"}}
```

## Fix it

### Step 1: List existing branches

```bash
node -e "console.log('call the list-branches endpoint and look for the branch name')"
```

Expected: You see the conflicting branch in the project.

### Step 2: Reuse the branch or delete the stale one

```bash
node -e "console.log('point the sync at the existing branch id, or delete it if it is abandoned')"
```

Expected: The sync targets a branch that exists exactly once.

### Step 3: Re-run the sync

```bash
node -e "console.log('run the branch sync again and confirm no 409')"
```

Expected: The sync completes without the conflict error.

## When to use this

- Crowdin branch creation returns 409
- Parallel CI jobs race to create the same branch

## When NOT to use this

- The project itself 404s, check the project id
- Uploads fail with 401, refresh the API credential

## Tool and version compatibility

- Crowdin API v2
- crowdin-api-client-js

## Variant phrasings

### 409 on every sync run

The sync never cleans up old branches. Add branch cleanup to the job.

### branch exists but sync still fails

The branch is archived. Unarchive it or create with a fresh name.

## Why it happens

Branch names are unique per Crowdin project. A sync that blindly creates the branch on every run collides with the one from the previous run, and the API answers 409 instead of silently duplicating.

## Edge cases

- Branch names are case-sensitive; 'Release' and 'release' are different branches
- Deleted branches can linger in the API list briefly
- Rate limits on branch listing can mask the real conflict in big projects

## Provenance

Resolved from the public thread: https://vectle.com/posts/pst_65QZfTHYNcK5XC1CPFBZvQ
