> 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/parsing-and-errors/error-model.md).

# Error Model

Internet Object defines two classes of error. Each reported error carries a stable **error code** (a hyphenated identifier), a human-readable message, and the **position** in the source where it occurred.

## Syntax errors

Raised while tokenizing or parsing, before any schema is applied. They describe malformed *text*. Representative codes:

| Code                           | Condition                                                          |
| ------------------------------ | ------------------------------------------------------------------ |
| `expecting-bracket`            | a `{`, `}`, `[`, or `]` is missing                                 |
| `unexpected-token`             | a token appears where the grammar does not allow it                |
| `unexpected-positional-member` | a positional value follows a keyed one in an object                |
| `unknown-member`               | a MemberDef uses an option the declared type does not define       |
| `string-not-closed`            | a quoted string has no closing quote                               |
| `value-required`               | a value was expected (e.g. a key with no value) but none was found |
| `invalid-datetime`             | a date/time literal is malformed                                   |

> A conformant parser SHOULD report a malformed **numeric** literal (such as `0o89` or `0xGH`) as a coded syntax error. The reference implementation currently raises an uncoded internal error for some of these — a known gap.

## Validation errors

Raised while validating data against a schema. They describe values that do not satisfy the schema. Representative codes:

| Code                                  | Condition                                           |
| ------------------------------------- | --------------------------------------------------- |
| `invalid-type`                        | value is not of the declared type                   |
| `not-a-bool` / `not-a-string`         | value is not a boolean / string for that field      |
| `invalid-range`                       | number/date outside `min`/`max`                     |
| `out-of-range` / `invalid-length`     | array/string length outside `minLen`/`maxLen`/`len` |
| `invalid-min-length`                  | string/array shorter than the minimum               |
| `invalid-choice`                      | value is not one of `choices`                       |
| `invalid-pattern`                     | string does not match `pattern`                     |
| `invalid-email` / `invalid-url`       | malformed email/URL                                 |
| `invalid-scale` / `invalid-precision` | decimal scale/precision violated                    |
| `value-required`                      | a required field is missing                         |
| `null-not-allowed`                    | `null` given for a non-nullable field               |
| `additional-values-not-allowed`       | extra values without an open (`*`) schema           |

> Error **codes are stable**; messages and exact positions may vary between implementation versions. Tooling should branch on the code, not the message.

## Definition errors

A third small group arises from header references: `schema-not-defined`, `variable-not-defined` (see [Error Handling in Definitions](/definitions/error-handling.md)).

## See Also

* [Parser Behavior & Recovery](/parsing-and-errors/parser-behavior.md) · [Error Accumulation](/parsing-and-errors/error-accumulation.md)
* [Conformance Requirements](/conformance/requirements.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:

```
GET https://docs.internetobject.org/parsing-and-errors/error-model.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
