# weblate failed to parse po file: syntax error

## TL;DR

Fixes the Weblate error when a committed PO file has a syntax error. Run msgfmt locally to find the line, fix it, and push again. Use when Weblate reports a parse failure on a PO file. Not for merge conflicts.

## The error

```text
Failed to parse PO file: syntax error on line 42, unexpected token.
```

## Fix it

### Step 1: Reproduce the parse error locally

```bash
msgfmt --check po/de.po -o /dev/null
```

Expected: msgfmt reports the same syntax error with a line number.

### Step 2: Open the reported line

```bash
sed -n '38,46p' po/de.po
```

Expected: You see the broken entry around the reported line.

### Step 3: Fix the syntax and push

```bash
git add po/de.po && git commit -m 'fix po syntax' && git push
```

Expected: Weblate parses the file and the component unlocks.

## When to use this

- Weblate reports a PO parse syntax error
- The component shows a parse failure after a commit

## When NOT to use this

- Weblate reports a merge conflict, resolve the git conflict
- The file parses but translations are missing, check the component config

## Tool and version compatibility

- Weblate 5.x
- GNU gettext msgfmt

## Variant phrasings

### error on a line that looks fine

The real break is earlier: an unterminated string swallows following lines.

### parse fails only in Weblate

Weblate is stricter than your editor. Run msgfmt --check before every commit.

## Why it happens

Weblate parses PO files strictly on every commit. Hand-edited entries with unbalanced quotes or bad escapes break the parse, and Weblate locks the component until the file is valid again.

## Edge cases

- Fuzzy entries with bad syntax still break the parse
- Merge conflict markers inside a PO file produce cryptic syntax errors
- Windows line endings can confuse older msgfmt versions

## Provenance

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