> For the complete documentation index, see [llms.txt](https://docs.internetobject.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.internetobject.org/structure-and-syntax/syntax-errors.md).

# Syntax Errors

Common syntax errors and how the parser recovers.

A **syntax error** is a problem in the *shape* of the text — an unbalanced brace, a missing comma, an unterminated string — detected while tokenizing or parsing, before any schema validation. (Errors about *values* — wrong type, out of range — are validation errors; see [Error Model](/parsing-and-errors/error-model.md).)

## Common syntax errors

### Unbalanced brackets

```ruby
pt: { object, schema: { x: int } }
---
{ 1                      # ✗ expected-closing-bracket  (the '{' is never closed)
```

The unclosed `{` raises `expected-closing-bracket`. (The predicate `unterminated-` is reserved for constructs the *tokenizer* closes, such as a quoted string; a bracket is closed by the parser.)

### Missing separators merge values

Values are comma-separated. Where a comma is omitted between two **values**, the text between them is a single [open string](/structure-and-syntax/values/string/open-strings.md), and an open string may contain spaces — so the result is one well-formed value, and there is nothing for a parser to reject:

```ruby
---
~ 101 Thomas 25      # → "101 Thomas 25" — one value, not three
```

A conformant parser **MUST NOT** report an error here, and **MUST NOT** insert the missing separators. This is the one fault the format cannot diagnose for you, and it is the direct cost of having open strings at all: the same property that lets `New York` be written without quotes is what makes `101 Thomas 25` a single value.

The rule stops at values. A missing separator before a **key** is still an error, because a key cannot follow an unseparated value:

```ruby
{John age: 25 gender: M}   # ✗ unexpected-token
```

### Unterminated string

A quoted string with no closing quote raises `unterminated-string`. This applies to every quoted form, including the annotated ones (`r'...'`, `b'...'`, `dt'...'`):

```ruby
"John Doe            # ✗ unterminated-string
r'C:\path           # ✗ unterminated-string
```

## Recovery is bounded by structure

On a syntax error the parser **skips ahead to the next boundary** — a record separator `~` or a section separator `---` (or end of file) — records the error, and resumes. So one malformed record does not prevent later records from being parsed. See [Parser Behavior & Recovery](/parsing-and-errors/parser-behavior.md).

## See Also

* [Error Model](/parsing-and-errors/error-model.md)
* [Parser Behavior & Recovery](/parsing-and-errors/parser-behavior.md)
* [Comments](/structure-and-syntax/comments.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.internetobject.org/structure-and-syntax/syntax-errors.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
