ueberdosis/tiptap · error

TableOfContents extension (name: "${extensionName}") not fou

Error message

TableOfContents extension (name: "${extensionName}") not found in the extensions array

What it means

Error "TableOfContents extension (name: "${extensionName}") not found in the extensions array" thrown in ueberdosis/tiptap.

Source

Thrown at packages/extension-table-of-contents/src/generate-toc-ids.ts:48

 * // → heading now has `id` and `data-toc-id` attributes
 * const html = renderToHTMLString({ content: docWithIds, extensions: [...] })
 *
 * @param doc - A Tiptap JSON document to add anchor IDs to.
 * @param extensions - The extensions to use. Must include the `TableOfContents` extension (or one extending it).
 * @param extensionName - Optional name of the `TableOfContents` extension to look up. Defaults to `'tableOfContents'`. Override this if you have extended the base extension and changed its `name`.
 * @returns The updated Tiptap JSON document.
 */
export function generateTocIds(
  doc: JSONContent,
  extensions: Extensions,
  extensionName = 'tableOfContents',
): JSONContent {
  const tocExtension = extensions.find(ext => ext.name === extensionName) as
    | typeof TableOfContents
    | undefined

  if (!tocExtension) {
    throw new Error(
      `TableOfContents extension (name: "${extensionName}") not found in the extensions array`,
    )
  }

  const schema = getSchema([...extensions.filter(ext => ext.name !== extensionName), tocExtension])
  const anchorTypes = tocExtension.options.anchorTypes ?? ['heading']
  const getId = tocExtension.options.getId ?? (() => uuidv4())

  const contentNode = PMNode.fromJSON(schema, doc)

  // Mirrors the TableOfContents plugin's appendTransaction in `plugin.ts`:
  // an anchor node gets a fresh id when its `data-toc-id` is missing or
  // already seen earlier in the document. We track original ids — including
  // null — to match the plugin's behavior exactly.
  type Update = { pos: number; attrs: Record<string, unknown> }
  const updates: Update[] = []
  const existingIds: Array<string | null | undefined> = []

View on GitHub (pinned to 496d53afd7)

When it happens

Trigger: Thrown at packages/extension-table-of-contents/src/generate-toc-ids.ts:48 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of ueberdosis/tiptap@496d53afd7 (2026-08-26). Data as JSON: /api/errors/76dff662e996e1f7. Report an issue: GitHub.