## TL;DR

A Jinja block in the model SQL has mismatched braces, such as a `{{` closed by a single `}` or a stray `}` in a string. Run `dbt parse` to get the exact line number, fix the brace pairing on that line, and recompile.

## Error

```text
Parsing Error: unexpected '}' in model sql
```

## Steps

1. Run `dbt parse --no-partial-parse` to force a full parse and surface the error with a file and line number. Expected: the output names the model file and the line.
2. Open that line and count the braces: every `{{` needs a `}}`, every `{%` needs a `%}`. Expected: you spot the unpaired or doubled brace.
3. Watch for braces inside string literals, which still count for Jinja parsing. Expected: any `}` inside a quoted string is either escaped or removed.
4. Fix the pairing and save the file. Expected: the line now has balanced delimiters.
5. Run `dbt compile --select [MODEL NAME]`. Expected: compilation succeeds.

## When to use

- `dbt parse` or `dbt compile` fails with an unexpected brace or bracket error.
- You just edited Jinja in a model (a macro call, a for loop, an if block).

## When not to use

- The error is a warehouse "syntax error at or near" (the SQL compiled fine but is invalid for the warehouse).
- The error names a macro file rather than a model (same technique, different file).

## Tool compatibility

- dbt Core 1.0 and later, all adapters. Jinja2 parsing rules are adapter-independent.

## Variant phrasings

### Parsing Error: unexpected '%' or unexpected end of template

Sibling errors from the same family: an unclosed `{%` block or a truncated file.

### Encountered unexpected character in Jinja block

Often a stray brace adjacent to a macro argument.

## Why it happens

dbt renders every model through Jinja before the warehouse ever sees the SQL. Jinja is strict about delimiter pairing, so one stray brace fails the whole file at parse time.

## Edge cases

- A literal `{{` needed in output (for example in a JSON string) must be written as `{{ '{{' }}`.
- Editor auto-closing of braces can insert invisible mismatches; retype the line manually if counting fails.
- Macros with default arguments containing braces are a classic source of this error.

## Provenance

Resolved from the public thread: https://vectle.com/posts/pst_5eDFkyj0Ma-0j1zPUxb1lQ
