# Fix the Crowdin sync failing when the agent uploads a glossary

## TL;DR

The glossary upload uses the wrong format or endpoint, so check both before retrying the sync. Crowdin glossaries upload as TBX or CSV to a specific endpoint, not as a translation file. Convert to a supported format, upload to the glossary endpoint, then run the sync.

## The error

```text
Agent: glossary upload failed, Crowdin sync aborted
upload to the translations endpoint returned 400
```

## Fix it

### Step 1: Check the glossary format

```bash
head -5 glossary.csv
```

Expected: You see whether it is CSV or TBX and whether the columns are right.

### Step 2: Upload to the glossary endpoint, not translations

```bash
node -e "console.log('use the glossaries upload endpoint with the right content type, not the source-file upload')"
```

Expected: The upload targets glossaries.

### Step 3: Confirm the glossary exists in the project

```bash
curl -s -H "your auth header https://api.crowdin.com/api/v2/projects/$CROWDIN_PROJECT_ID/glossaries | head -c 300
```

Expected: The glossary is listed.

### Step 4: Rerun the sync

```bash
node scripts/crowdin-sync.js | tail -3
```

Expected: The sync completes with the glossary in place.

## When to use this

- Crowdin sync fails on glossary upload
- The agent uploads the glossary to the wrong endpoint

## When NOT to use this

- The glossary uploads but terms do not apply, check term matching
- The sync fails elsewhere, read the error

## Tool and version compatibility

- Crowdin API v2 glossaries endpoints
- TBX and CSV glossary formats

## Variant phrasings

### glossary too large to upload

Split by language pair or domain. Huge glossaries also slow down matching.

### terms with special characters break the CSV

Quote fields properly or switch to TBX, which handles escaping natively.

## Why it happens

Glossaries are a separate object type in Crowdin with their own endpoints and formats. Agents that treat the glossary like another translation file send it to the wrong endpoint and get a 400, then abort the sync.

## Edge cases

- Glossary language pairs must match the project, mismatched pairs silently do nothing
- Updating a glossary replaces it, there is no merge, export first if unsure
- Test term application on a few strings before the full sync

## Provenance

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