toeverything/AFFiNE · error
Failed to parse or decode footnote definition:
Error message
Failed to parse or decode footnote definition:
What it means
Warning logged in the bookmark markdown adapter when the footnote definition for a bookmark reference cannot be processed — either JSON.parse fails on the definition string or FootNoteReferenceParamsSchema validation fails, or the subsequent URL decodeURIComponent throws on malformed encoding. The bookmark is skipped and the rest of the document is converted normally.
Source
Thrown at blocksuite/affine/blocks/bookmark/src/adapters/markdown/markdown.ts:63
}
let footnoteDefinitionJson;
try {
footnoteDefinitionJson = FootNoteReferenceParamsSchema.parse(
JSON.parse(footnoteDefinition)
);
// If the footnote definition contains url, decode it
if (footnoteDefinitionJson.url) {
footnoteDefinitionJson.url = decodeURIComponent(
footnoteDefinitionJson.url
);
}
if (footnoteDefinitionJson.favicon) {
footnoteDefinitionJson.favicon = decodeURIComponent(
footnoteDefinitionJson.favicon
);
}
} catch (err) {
console.warn('Failed to parse or decode footnote definition:', err);
return;
}
const { url, favicon, title, description } = footnoteDefinitionJson;
walkerContext
.openNode(
{
type: 'block',
id: nanoid(),
flavour: BookmarkBlockSchema.model.flavour,
props: {
url,
footnoteIdentifier,
icon: favicon,
title,
description,
style: 'citation',
},View on GitHub (pinned to b4c8548c09)
Solutions
- Fix the footnote definition encoding in the source.
- Remove the malformed footnote.
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Triggered when the bookmark markdown adapter fails to JSON-parse the footnote definition or to decodeURIComponent its url/favicon fields during markdown import.
Common situations: Occurs when pasting or importing markdown whose bookmark footnote JSON is malformed or contains invalid percent-encoding. The bookmark is skipped; fix the footnote payload.
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 toeverything/AFFiNE@b4c8548c09 (2026-08-18).
Data as JSON: /api/errors/55ae6878b8fe70f3.
Report an issue: GitHub.