# Parser Error: The SQL does not parse

> DuckDB could not parse the statement at all, and the message names the first token that broke the grammar.

Source: https://sqlly.app/errors/duckdb/parser-syntax-error
Last updated: 2026-11-30
License: Text and data [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) (credit SQLly, sqlly.app); code and SQL snippets [MIT](https://opensource.org/license/mit). [Details](https://sqlly.app/license).
Note: Quoted error message text belongs to its database vendor.

- Exception: `Parser Error`
- Category: Parser and syntax errors

Error message:

```text
Parser Error: syntax error at or near "SELEC"
```

## What it means

`Parser Error: syntax error at or near "..."` is DuckDB's pure syntax failure: the text is not valid SQL grammar, so nothing was planned or executed. The quoted token is where the parser gave up, which is usually at or just after the real mistake. Client libraries raise the same class on their side, typically as a `ParserException`.

The token itself is often innocent; the error is what comes before it, such as a doubled comma, an unclosed parenthesis, a reserved word used as an identifier, or a keyword misspelled. An unclosed quote gives a different message, Parser Error: unterminated string literal. Statements pasted from other dialects fail here too, for example SQL Server's square-bracket identifiers, which DuckDB does not read. Backtick quoting stopped failing in DuckDB 2.0, which now reads MySQL-style backtick identifiers.

## Common causes

- A misspelled keyword such as SELEC, or a keyword used as a column name without quoting.
- A missing or extra comma, parenthesis, or closing quote earlier in the statement.
- Syntax from another dialect: square-bracket identifiers that are keywords, such as [order], or TOP instead of LIMIT (backtick quoting parses since DuckDB 2.0).
- Splitting a script on semicolons and sending a fragment, so a statement starts mid-expression.

## How to fix it

1. Look at the token before the one named in the message; that is usually where the mistake is.
2. Quote identifiers with double quotes when they collide with keywords:

   ```sql
   SELECT "order", "group" FROM t;
   ```
3. Translate dialect syntax to DuckDB: LIMIT instead of TOP, standard double-quote identifiers:

   ```sql
   SELECT [order] FROM t;
   -- becomes
   SELECT "order" FROM t LIMIT 10;
   ```
4. Build statements in code with parameters instead of string splicing, which is where most stray quotes come from:

   ```sql
   SELECT * FROM t WHERE id = ?;
   ```

## Reproduce it safely

```sql
SELEC 1;   -- Parser Error: syntax error at or near "SELEC"
```

## Questions

### Parser Error or Binder Error: what is the difference?

A Parser Error means the text is not valid SQL grammar. A Binder Error means the SQL parsed but names or types could not be resolved against the schema.

### The token in the message looks fine. What now?

Check before it: an unclosed parenthesis makes the parser fail at the first token after the gap, so the reported position is downstream of the real mistake. An unclosed quote is different: DuckDB reports Parser Error: unterminated string literal with the caret on the opening quote.

## Related errors

- [`Binder Error`](https://sqlly.app/errors/duckdb/binder-error): DuckDB could not plan the query
- [`Catalog Error`](https://sqlly.app/errors/duckdb/catalog-table-not-exist): The table does not exist in this database
- [`SQLITE_ERROR`](https://sqlly.app/errors/sqlite/sqlite-error): SQLite: SQL logic error
- [`42601`](https://sqlly.app/errors/postgresql/42601): PostgreSQL: syntax error at or near
- [`1064`](https://sqlly.app/errors/mysql/1064): MySQL: You have an error in your SQL syntax

The code and message text are from the [DuckDB documentation](https://duckdb.org/docs/).
