{"record":{"id":"e6c26f6b676f703c","repo":"siyuan-note/siyuan","slug":"conf-language-115-pandoc-binary-invalid","errorCode":null,"errorMessage":"Conf.Language(115) (Pandoc binary invalid)","messagePattern":"Conf\\.Language\\(115\\) \\(Pandoc binary invalid\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/export.go","lineNumber":1105,"sourceCode":"\t\treturn nil\n\t}); exportErr != nil {\n\t\tlogging.LogErrorf(\"export preview [%s] failed: %s\", id, exportErr)\n\t\treturn\n\t}\n\treturn\n}\n\nfunc ExportDocx(id, savePath string, removeAssets, merge bool, mergeHeadingOptions ...MergeHeadingOptions) (fullPath string, err error) {\n\tif err = prepareExportBlockAssets(id, merge); err != nil {\n\t\treturn\n\t}\n\terr = withExportReadLockByBlockID(id, func() error {\n\t\tpandocRuntime := util.GetPandocRuntime()\n\t\tif !util.IsValidPandocBin(pandocRuntime.BinPath) {\n\t\t\tutil.InitPandoc(Conf.Export.PandocBin)\n\t\t\tpandocRuntime = util.GetPandocRuntime()\n\t\t\tif !util.IsValidPandocBin(pandocRuntime.BinPath) {\n\t\t\t\treturn errors.New(Conf.Language(115))\n\t\t\t}\n\t\t}\n\n\t\ttmpDir := filepath.Join(util.TempDir, \"export\", gulu.Rand.String(7))\n\t\tif bt := getExportBlockTree(id); bt != nil && IsEncryptedBox(bt.BoxID) {\n\t\t\texportID, idErr := newManagedEncryptedExportID()\n\t\t\tif idErr != nil {\n\t\t\t\treturn idErr\n\t\t\t}\n\t\t\ttmpDir = filepath.Join(util.TempDir, \"export\", bt.BoxID, \"docx\", exportID)\n\t\t}\n\t\tif mkdirErr := os.MkdirAll(tmpDir, 0755); mkdirErr != nil {\n\t\t\treturn mkdirErr\n\t\t}\n\t\tdefer os.RemoveAll(tmpDir)\n\t\tname, content, exportErr := exportMarkdownHTML(id, tmpDir, true, merge, mergeHeadingOptions...)\n\t\tif exportErr != nil {\n\t\t\treturn exportErr","sourceCodeStart":1087,"sourceCodeEnd":1123,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/8641553a1f07374001902d3ce773285db1292b2d/kernel/model/export.go#L1087-L1123","documentation":"ExportDocx (kernel/model/export.go:1105) requires a working Pandoc binary. It checks util.IsValidPandocBin; if invalid it attempts util.InitPandoc(Conf.Export.PandocBin) once more, and if the binary is still invalid it returns the localized message Conf.Language(115): 'Please configure [Settings - Export - Pandoc - Path to Pandoc executable] first'.","triggerScenarios":"Calling the docx export API (/api/export/exportDocx) when the Pandoc executable path is unset, points to a non-existent file, or the binary is not a valid Pandoc executable.","commonSituations":"Fresh SiYuan install without Pandoc installed; Pandoc removed or upgraded to a path not configured in Settings - Export - Pandoc; wrong path typed into the Pandoc bin setting; container image lacking the Pandoc dependency.","solutions":["Install Pandoc and set the correct executable path in Settings - Export - Pandoc - Path to Pandoc executable.","Set Conf.Export.PandocBin in the configuration to the absolute pandoc binary path and retry.","Verify the configured path with util.IsValidPandocBin-equivalent: run '<path> --version' on the host.","On Docker, use an image that bundles Pandoc or mount the binary into the container and configure its path."],"exampleFix":"// before (config)\n\"PandocBin\": \"\"\n// after\n\"PandocBin\": \"/usr/bin/pandoc\"","handlingStrategy":"validation","validationCode":"const conf = await fetchPost('/api/conf/getConf');\nconst bin = conf.data.conf.export.pandocBin;\n// verify the configured binary exists and runs before exporting\nif (!bin) throw new Error('Configure Pandoc path in Settings - Export first');","typeGuard":null,"tryCatchPattern":"try {\n  await exportDocx(payload);\n} catch (e) {\n  if (String(e.msg).includes('Pandoc')) {\n    await promptUserToConfigurePandoc();\n  }\n}","preventionTips":["Install Pandoc and set its absolute path in Settings - Export - Pandoc before first docx export","Re-check the Pandoc path after OS upgrades or container rebuilds","Run '<pandoc path> --version' as a preflight in scripted environments"],"tags":["pandoc","export","docx","missing-dependency"],"backgroundTag":"missing-dependency","analyzedSha":"8641553a1f07374001902d3ce773285db1292b2d","analyzedAt":"2026-09-11T16:08:28.414Z","contentChangedAt":"2026-09-11T16:08:28.414Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}