siyuan-note/siyuan · warning
pandoc output is too large
Error message
pandoc output is too large
What it means
convertClipboardMathWithRunner runs the pandoc runner to convert clipboard math (e.g. from docx/latex sources) and enforces maxClipboardMathPandocOutput on the produced JSON. If pandoc's output exceeds that limit the conversion is aborted with 'pandoc output is too large' to protect the kernel from unbounded memory/CPU on pathological inputs.
Solutions
- Reduce the size of the pasted math (split it into several smaller equations).
- Verify the input passed to the runner is a single math snippet, not the full document; for docx the fallback isSimplePandocMathDocument path only handles simple docs.
- Raise maxClipboardMathPandocOutput if legitimate equations are being rejected (trade-off with memory use).
- Strip irrelevant formatting from the source before conversion (e.g. re-export the equation cleanly from Word/WPS).
Example fix
// before output := convertEntireDocxToPandocJSON(clip) // too large // after mathXML := extractSingleOMML(clip) // just the equation output, ok, err := convertClipboardMathWithRunner(runner, "docx", mathXML)
Defensive patterns
Strategy: fallback
Validate before calling
const rough = input.length * 8; if (rough > maxClipboardMathPandocOutput) askUserToSplitEquation()
Try / catch
try { math = await convertClipboardMath(src) }
catch (e) { if (e.message === "pandoc output is too large") { fallbackToPlainRender(); notify("Equation too large, rendered as-is") } else throw e } Prevention
- Convert single math snippets, never whole documents
- Split very large composite equations before pasting
- Benchmark worst-case equation sizes against maxClipboardMathPandocOutput when changing limits
When it happens
Trigger: Pasting clipboard content whose single-math pandoc JSON serialization exceeds maxClipboardMathPandocOutput — huge embedded equations, documents with enormous OMML/Docx math, or a runner misconfigured to output the whole document instead of one math node.
Common situations: Pasting a very large Word formula object; WPS-produced docx with bloated math markup; a bug causing the runner to convert the entire document rather than the selected math.
Understand the failure class
Background: "File too large" / "file size exceeds limit" errors: why libraries cap file sizes and how to fix them — this error's family across 46 libraries.
Related errors
- Agent capability name and description are required
- BASE64_IMAGE_SIZE_LIMIT
- batch
- checksum manifest is too large
- Conf.Language(115)
AI-assisted analysis of siyuan-note/siyuan@9f775e8a12 (2026-09-19).
Data as JSON: /api/errors/e19040f52eed6caa.
Report an issue: GitHub.
Appendix: source
Thrown at kernel/api/lute_clipboard_math.go:107
}
markdown, converted, err := convertClipboardMathWithRunner("", "", base64.StdEncoding.EncodeToString(input), runClipboardMathPandoc)
if err != nil {
logging.LogWarnf("convert Office HTML clipboard math with pandoc failed: %s", err)
}
return markdown, converted
}
func convertClipboardMathWithRunner(mathML, office, wps string, runner clipboardMathPandocRunner) (markdown string, converted bool, err error) {
from, input, ok := clipboardMathPandocInput(mathML, office, wps)
if !ok {
return
}
output, err := runner(from, "json", input)
if err != nil {
return "", false, err
}
if len(output) > maxClipboardMathPandocOutput {
return "", false, fmt.Errorf("pandoc output is too large")
}
math, ok := parsePandocSingleMath(output)
if !ok {
if from != "docx" || !isSimplePandocMathDocument(output) {
return "", false, nil
}
markdownOutput, writeErr := runner("json", "markdown-raw_attribute", output)
if writeErr != nil {
return "", false, writeErr
}
if len(markdownOutput) > maxClipboardMathPandocOutput {
return "", false, fmt.Errorf("pandoc output is too large")
}
markdown = strings.TrimSpace(strings.ReplaceAll(string(markdownOutput), "<!-- -->", ""))
return markdown, markdown != "", nil
}
if math.display {
return "$$\n" + math.tex + "\n$$", true, nilView on GitHub (pinned to 9f775e8a12)