{"record":{"id":"369cd0f6dee1f1fe","repo":"siyuan-note/siyuan","slug":"not-found-executable-pandoc","errorCode":null,"errorMessage":"not found executable pandoc","messagePattern":"not found executable pandoc","errorType":"exception","errorClass":"ErrPandocNotFound","httpStatus":null,"severity":"error","filePath":"kernel/util/pandoc.go","lineNumber":33,"sourceCode":"// along with this program.  If not, see <https://www.gnu.org/licenses/>.\n\npackage util\n\nimport (\n\t\"bytes\"\n\t\"errors\"\n\t\"os\"\n\t\"os/exec\"\n\t\"path/filepath\"\n\t\"runtime\"\n\t\"strings\"\n\t\"sync\"\n\n\t\"github.com/88250/gulu\"\n\t\"github.com/siyuan-note/logging\"\n)\n\nvar ErrPandocNotFound = errors.New(\"not found executable pandoc\")\n\nfunc ConvertPandoc(dir string, args ...string) (path string, err error) {\n\tpandocBinPath := GetPandocRuntime().BinPath\n\tif \"\" == pandocBinPath || ContainerStd != Container {\n\t\terr = ErrPandocNotFound\n\t\treturn\n\t}\n\n\tpandoc := exec.Command(pandocBinPath, args...)\n\tgulu.CmdAttr(pandoc)\n\tpath = filepath.Join(\"temp\", \"convert\", \"pandoc\", dir)\n\tabsPath := filepath.Join(WorkspaceDir, path)\n\tif err = os.MkdirAll(absPath, 0755); err != nil {\n\t\tlogging.LogErrorf(\"mkdir [%s] failed: [%s]\", absPath, err)\n\t\treturn\n\t}\n\tpandoc.Dir = absPath\n\toutput, err := pandoc.CombinedOutput()","sourceCodeStart":15,"sourceCodeEnd":51,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/9f775e8a12daef8255556097396f9b2739078892/kernel/util/pandoc.go#L15-L51","documentation":"ErrPandocNotFound is the sentinel error returned when the pandoc executable cannot be located or when running in a container where pandoc is unavailable. GetPandocRuntime().BinPath is empty when pandoc is not installed or not on PATH, and ContainerStd != Container means the deployment container lacks the pandoc bundle.","triggerScenarios":"Calling util.Pandoc / ConvertPandoc or the clipboard-math API (kernel/api/lute_clipboard_math.go:328) when pandoc was never found on the system or the kernel runs in the standard container image without pandoc.","commonSituations":"Pandoc not installed on the host; pandoc installed but not in the kernel process PATH; running the Docker image variant that ships without pandoc; broken pandoc install after an OS upgrade.","solutions":["Install pandoc on the host and ensure its directory is in the kernel process PATH","Restart the kernel after installing so GetPandocRuntime() re-detects the binary","If using containers, switch to the image variant that bundles pandoc or add pandoc to the image","Verify detection by checking that the pandoc command resolves before invoking SiYuan"],"exampleFix":"// before (error returned)\nout, err := api.ConvertClipboardMath(...) // util.ErrPandocNotFound\n// after (ensure pandoc present)\n# apt-get install -y pandoc  (or download from pandoc.org and add to PATH)\n# restart SiYuan kernel, then retry the conversion","handlingStrategy":"fallback","validationCode":"if runtime.GOOS != \"windows\" {\n  if _, err := exec.LookPath(\"pandoc\"); err != nil {\n    return errors.New(\"pandoc is required but not found on PATH\")\n  }\n}","typeGuard":null,"tryCatchPattern":"path, err := util.Pandoc(args...)\nif errors.Is(err, util.ErrPandocNotFound) {\n  // degrade gracefully: skip pandoc-based conversion, inform user to install pandoc\n  return nil, fmt.Errorf(\"pandoc unavailable: %w\", err)\n}","preventionTips":["Install pandoc before deploying or use the container image variant that bundles it","Check pandoc availability at kernel startup and surface a settings warning","After OS upgrades, re-verify pandoc is still on PATH","Document the pandoc requirement wherever the export/clipboard-math feature is used"],"tags":["pandoc","missing-dependency","export"],"backgroundTag":"command-not-found","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"}