For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt, and this page is available as Markdown at /guide/troubleshooting.md.
  • English
  • Troubleshooting

    Three checks usually locate the problem:

    1. Read the placeholder label: labels distinguishes "not evaluated", "blocked", and "unknown structure".
    2. Read document.diagnostics: each record has stage, code, and a source position.
    3. Reduce to the smallest source and options; remove custom plugins and components to reproduce.

    If you are unsure whether a placeholder is expected, compare it with the default output in the overview and syntax support.

    Display

    SymptomCauseFix
    Template area shows a placeholderThe default pipeline does not evaluate templatesUse /expand, or override semanticComponents.template
    Parser function shows a placeholderSame; not evaluated by defaultSupported pure wikitext functions work through /expand; others stay placeholders
    Images show only captionsNo resolveImage, or it returned nullReturn a validated src; enable allowRelativeImages for relative URLs
    Internal links are not clickableDefault output is non-navigable textReturn href from resolveLink
    External links become plain textProtocol is not allowlistedUse http:, https:, or mailto:
    HTML becomes a source cardUnknown or unbalanced tagCheck support; custom semantic nodes need handlers
    Dangerous tags leave only a hintscript, iframe, etc. are blockedExpected; do not relax stripTags just to display them
    A whole table becomes a source cardNested wikitext tableFlatten the table, or use nested HTML <table>
    Paragraphs mergeA single newline collapses to a spaceUse two blank lines to split
    No table of contentsFewer than four headings, __NOTOC__, or headingIdStrategy: "none"Check headings and behavior switches; use __TOC__ to pin the position
    The reference section is not at <references>It is fixed after the body, before categoriesExpected; the tag does not control its position
    Categories are missing from the bodyThey are collected into the footerExpected; label text comes from labels.categories
    Heading anchors collideMultiple instances share bare idsUse the default instance strategy, or pass idPrefix

    See Syntax support for the full default output.

    Runtime and build

    SymptomCauseFix
    ASYNC_PLUGIN_IN_SYNC_PATHAsync plugin on the sync pathUse prepareWikitextAsync, or prepare outside React
    Parsing happens on every renderInline parseOptions / prepareOptions objectsMove them out of the component or stabilize with useMemo
    PARSER_UNAVAILABLEThe wikiparser-node browser bundle did not initialize globalThis.ParserEnsure the side-effect import runs; avoid duplicate copies or manual dependency pruning
    Cannot find module 'react-wikitext/styles.css'CSS not handled by the bundler, or the build lacks dist/styles.cssLet the bundler handle package CSS; confirm resolution to dist/styles.css
    Next.js Server Component throws a createContext errorA React entry was called from the server in an environment with RSC boundariesConfirm the build ships "use client"; use server preparation on the server
    Hydration mismatch or drifting anchorsServer and client trees differ, or no id prefix is fixedRender the same tree; pass idPrefix; consider the mediawiki strategy
    Type error: no error classes on the root entryError classes are exported per subpathImport from /parse, /hast, or /expand
    CJS environment fails to loadRuntime too old, or bundler ignores exportsUse Node >=18.18 and a bundler that supports conditional exports

    Error codes

    Errors carry code; prepare errors also carry stage. Never branch on message text.

    CodeStageMeaningAction
    SOURCE_TOO_LONGParseNormalized source exceeds the length budgetRaise maxSourceLength, or split the content
    SOURCE_TOO_COMPLEXParseNode or depth budget exceededRaise the relevant budget, or simplify structure
    INVALID_CONFIGParseSite config or a budget field is invalidPass non-negative safe integers
    PARSE_FAILEDParseUpstream parsing or semantic building failedKeep the source and cause, and report it
    PARSER_UNAVAILABLEParseThe default browser bundle did not initializeCheck the build and dependency resolution
    PREPARE_FAILEDPrepareOptions, plugin, or handler is invalidCheck policy, labels, handlers, and plugin signatures
    ASYNC_PLUGIN_IN_SYNC_PATHPrepareAsync plugin on the sync pathUse the async entry
    INVALID_DOCUMENTRestoreSnapshot structure, version, or budget is invalidRestore trusted snapshots only; invalidate old caches
    EXPANSION_TOO_LARGEExpandExpanded output or preserved source is too largeRaise maxExpandedLength, or limit template output
    EXPANSION_BUDGET_EXCEEDEDExpandBudget exceeded under strictRaise the budget, or turn off strict to keep calls
    TEMPLATE_LOOPExpandLoop detected under strictInspect template dependencies
    ABORTEDExpandCancelled through signalExpected; the original reason is in cause

    See Errors and diagnostics for the full list and class hierarchy.

    Reading diagnostics

    for (const diagnostic of prepared.diagnostics) {
      console.warn(diagnostic.stage, diagnostic.code, diagnostic.message);
    }
    • stage can be parse, expand, wikitext, hast, rehype, sanitize, or finalize.
    • A diagnostic never aborts the whole page; a render failure replaces only the affected top-level block.
    • View failures are reported through onRenderError; the placeholder title comes from labels.renderFailed.
    • meta records the effective policy, labels, headingIdStrategy, and authorized images, which helps confirm that config actually applied.

    Still stuck

    When reporting, include:

    • The smallest wikitext source and pageName.
    • Entry, parse options, and prepare options (redacted if needed).
    • Library version, parserVersion, React, and bundler versions.
    • document.diagnostics plus the error code, stage, and cause.

    More channels are listed in Contributing and feedback.