ueberdosis/tiptap · error
Failed to parse HTML string
Error message
Failed to parse HTML string
What it means
Error "Failed to parse HTML string" thrown in ueberdosis/tiptap.
Source
Thrown at packages/html/src/generateJSON.ts:33
* const json = generateJSON(html, extensions)
* console.log(json) // { type: 'doc', content: [{ type: 'paragraph', content: [{ type: 'text', text: 'Hello, world!' }] }] }
*/
export function generateJSON(
html: string,
extensions: Extensions,
options?: ParseOptions,
): Record<string, any> {
if (typeof window === 'undefined') {
throw new Error(
'generateJSON can only be used in a browser environment\nIf you want to use this in a Node environment, use the `@tiptap/html/server` import instead.',
)
}
const schema = getSchema(extensions)
const doc: Document = new window.DOMParser().parseFromString(html, 'text/html')
if (!doc) {
throw new Error('Failed to parse HTML string')
}
return DOMParser.fromSchema(schema)
.parse(doc.body as Node, options)
.toJSON()
}
View on GitHub (pinned to 496d53afd7)
When it happens
Trigger: Thrown at packages/html/src/generateJSON.ts:33 when the library encounters an invalid state.
Common situations: See trigger scenarios.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
AI-assisted analysis of ueberdosis/tiptap@496d53afd7 (2026-08-26).
Data as JSON: /api/errors/6a9f43f74bad37e6.
Report an issue: GitHub.