{"record":{"id":"b49bce9d5a2d13c2","repo":"siyuan-note/siyuan","slug":"unsupported-table-cell-rich-text-format","errorCode":null,"errorMessage":"Unsupported table cell rich text format","messagePattern":"Unsupported table cell rich text format","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"app/src/protyle/util/tableCellRichValue.ts","lineNumber":25,"sourceCode":"    content: string;\n}\n\nexport const encodeTableCellRich = (content: string) => {\n    const bytes = new TextEncoder().encode(JSON.stringify({spec: 1, format: \"kramdown\", content}));\n    let binary = \"\";\n    bytes.forEach(byte => binary += String.fromCharCode(byte));\n    return btoa(binary).replace(/\\+/g, \"-\").replace(/\\//g, \"_\").replace(/=+$/, \"\");\n};\n\nexport const decodeTableCellRich = (encoded: string): TableCellRich => {\n    if (!/^[A-Za-z0-9_-]+$/.test(encoded)) {\n        throw new Error(\"Invalid table cell rich text payload\");\n    }\n    const bytes = Uint8Array.from(atob(encoded.replace(/-/g, \"+\").replace(/_/g, \"/\")), char => char.charCodeAt(0));\n    const value = JSON.parse(new TextDecoder(\"utf-8\", {fatal: true}).decode(bytes));\n    if (!value || Object.keys(value).length !== 3 || value.spec !== 1 || value.format !== \"kramdown\" ||\n        typeof value.content !== \"string\" || value.content.includes(\"\\u0000\")) {\n        throw new Error(\"Unsupported table cell rich text format\");\n    }\n    return value;\n};\n","sourceCodeStart":7,"sourceCodeEnd":29,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/9f775e8a12daef8255556097396f9b2739078892/app/src/protyle/util/tableCellRichValue.ts#L7-L29","documentation":"A sentinel validation error from the table cell rich-text decoder: decodeTableCellRich only accepts kramdown-format cells whose embedded spec/format fields match what it supports (spec 1, format \"kramdown\"), and the base64url-decoded JSON payload named a different spec or format version. The input at fault is the encoded string passed in — e.g. a cell attribute written by a newer SiYuan version, hand-edited .sy content, or data produced by a plugin using another markup format. The preceding regex guard already rejects malformed base64; this error specifically means well-formed payload, unsupported schema.","triggerScenarios":"Thrown at app/src/protyle/util/tableCellRichValue.ts:25 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Wrap decodeTableCellRich calls in try-catch and fall back to rendering the cell as plain kramdown text when the format is unrecognized","Version-gate new formats by incrementing spec and keeping decoders for older specs so existing notebooks keep rendering","Validate plugin/third-party writes that produce cell rich-text attributes against the documented spec 1 kramdown shape","On upgrade paths, migrate old cell payloads explicitly rather than relying on the decoder to guess"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"9f775e8a12daef8255556097396f9b2739078892","analyzedAt":"2026-09-19T03:17:15.984Z","contentChangedAt":"2026-09-19T03:17:15.984Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}