# Problem code `'document-error'`

> Contract 2.0.0 · package sha256 `a857eca95b35921109faf997094bb4192f12527d9d0fcd4be7e97f06425bad6e` · generated from `configurator-runtime.d.ts`, `tables/problems.json` and `services/onsite-scripter/scripts/contract-docs-what-to-do.json` by `services/onsite-scripter/scripts/build-contract-docs.mjs`; edit the source, not this file.

A member of [`ProblemCode`](../api/ProblemCode.md) · stable · since 2.0.0

A document layer has an invalid or version-1 key; `didYouMean` names its 2.0 home.

## What to do

Fix the key or value at `problem.path` in `problem.layer`: a version-1 key moves to the 2.0 home `problem.didYouMean` names (and the document says `version: 2`). Check the document with [`validate('document', doc)`](../api/validate.md) before [`session.applyDocument(doc)`](../api/Session.applyDocument.md).

```ts
const r = await session.applyDocument(doc);
if (!r.ok) for (const p of r.problems) console.warn(p.path, p.didYouMean);
```

## Where the declaration names it

- [`ApplyReport.problems`](../api/ApplyReport.problems.md): Each rejected key: code 'document-error', its JSON path in the document, `layer`, and for a version-1 key `didYouMean` with its 2.0 home (a runtime-owned AR or XR key names the account's published layer).
- [`BootOptions.document`](../api/BootOptions.document.md): Version 2 only: a version-1 key records 'document-error' with `didYouMean` naming its 2.0 home.
- [`Problem.layer`](../api/Problem.layer.md): The document layer, for 'document-error' and 'apply-failed' (see `info().document.layers`).
- [`Session.applyDocument`](../api/Session.applyDocument.md): Errors: a bad layer resolves `ok: false` with 'document-error' problems; it never rejects for content.
- [`ViewerDocumentJson`](../api/ViewerDocumentJson.md): Under contract 2.0 a version-1 key in the page layer records 'document-error' with `didYouMean`.
- [`ViewerDocumentJson.version`](../api/ViewerDocumentJson.version.md): A version-1 page document is refused key by key ('document-error').

The set is open: handle a code you don't know (`'other'`).
