Search page titles, headings and text across the docs.

Reference

On this page

Errors

Use this page to look up an error code and fix what caused it. Every package uses the same codes, so you can handle errors the same way in Rust, TypeScript, and Dart.

Reading the code

LanguageError typeCode
TypeScriptCanvistErrorerror.code, after isCanvistError(error)
RustHeadlessErrorerror.code(), an ErrorCode
DartCanvistExceptionexception.code, an ErrorCode
import { createEngine, isCanvistError } from "@canvist/headless";

const engine = await createEngine();
const stored = '{ "type": "doc", "content": [{ "type": "image" }] }';
try {
	engine.fromJson(JSON.parse(stored));
} catch (error) {
	if (!isCanvistError(error)) throw error;
	console.log(error.code);
	// schema
}

Codes

CodeWhat happenedFix
configThe engine’s extensions don’t fit togetherCheck the extensions you registered, and the ones they depend on
parseInput isn’t valid in its format, such as malformed JSONCheck the input, or load it as HTML or Markdown, which never fail
schemaJSON contains blocks or marks the engine didn’t registerRegister the missing extensions, or import through HTML or Markdown
unknownNameA command or query name doesn’t exist on this engineCheck the catalogue, and register the extension
invalidArgsA command’s arguments are missing or out of rangeMatch the command’s arguments, such as a heading level from 1 to 6
invalidPositionA position points at a block that doesn’t exist, or past its textUse the path of a text block, and an offset in UTF-16 code units within its text
invalidKeyA key name passed to press isn’t validWrite keys like Mod-b or Shift-Enter; see Keyboard shortcuts
editorThe editing engine refused a changeReport it, with the document and the call that failed
snapshotA snapshot passed to restore is malformedPass the string snapshot() returned, unchanged
notSharedA collaboration call on a document that isn’t sharedCall share(clientId) first, or load the document with fromYjs
alreadySharedshare on a document that’s already sharedShare once
collabA Yjs update or sync message couldn’t be decoded or appliedCheck the transport passes binary messages through unchanged
renderServer-side rendering failedCheck registered fonts are valid TrueType or OpenType files
Docs