# Problem code `'apply-failed'`

> 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

The runtime failed while applying a document layer, not for a bad key ('document-error'): one entry with `layer` and no `path` in [`ApplyReport.problems`](../api/ApplyReport.problems.md) ([`applyDocument`](../api/Session.applyDocument.md), `'document:applied'`); at boot, in [`info().problems`](../api/InfoReport.problems.md).

## What to do

An internal failure, not your key: applying the layer in `problem.layer` failed inside the runtime. When it is your page layer ('boot'), call [`session.applyDocument(document)`](../api/Session.applyDocument.md) once more; report it with `layer` when it repeats.

## Where the declaration names it

- [`ApplyReport.applied`](../api/ApplyReport.applied.md): Empty when superseded, when the document is no version-2 object at all, or when the apply failed inside the runtime ('apply-failed').
- [`ApplyReport.ok`](../api/ApplyReport.ok.md): False when `problems` holds any: a key was rejected, or the whole layer was (no version-2 object, or 'apply-failed').
- [`ApplyReport.problems`](../api/ApplyReport.problems.md): A failure inside the runtime while applying: one 'apply-failed' with `layer` and no `path`.
- [`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): A failure inside the runtime while applying resolves `ok: false` too, with one 'apply-failed' problem (`layer`, no `path`); it never rejects for that either.
- [`testing.FakeSession.script`](../api/testing.FakeSession.script.md): 'session.applyDocument' has one row, 'apply-failed' (its default `problem`): it resolves `ok: false` with one 'apply-failed' problem, and `delayMs` holds the apply unfinished, so a newer apply supersedes it or a `signal` aborts it.

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