siyuan-note/siyuan · error · ErrPandocNotFound
not found executable pandoc
Error message
not found executable pandoc
What it means
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.
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
Example fix
// before (error returned) out, err := api.ConvertClipboardMath(...) // util.ErrPandocNotFound // after (ensure pandoc present) # apt-get install -y pandoc (or download from pandoc.org and add to PATH) # restart SiYuan kernel, then retry the conversion
Defensive patterns
Strategy: fallback
Validate before calling
if runtime.GOOS != "windows" {
if _, err := exec.LookPath("pandoc"); err != nil {
return errors.New("pandoc is required but not found on PATH")
}
} Try / catch
path, err := util.Pandoc(args...)
if errors.Is(err, util.ErrPandocNotFound) {
// degrade gracefully: skip pandoc-based conversion, inform user to install pandoc
return nil, fmt.Errorf("pandoc unavailable: %w", err)
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Conf.Language(115) (Pandoc binary invalid)
- ErrPandocNotFound
- Conf.Language(115)
- Conf.Language(14) (pandoc output: )
- pandoc convert failed (joined command error and raw output)
AI-assisted analysis of siyuan-note/siyuan@9f775e8a12 (2026-09-19).
Data as JSON: /api/errors/369cd0f6dee1f1fe.
Report an issue: GitHub.
Appendix: source
Thrown at kernel/util/pandoc.go:33
// along with this program. If not, see <https://www.gnu.org/licenses/>.
package util
import (
"bytes"
"errors"
"os"
"os/exec"
"path/filepath"
"runtime"
"strings"
"sync"
"github.com/88250/gulu"
"github.com/siyuan-note/logging"
)
var ErrPandocNotFound = errors.New("not found executable pandoc")
func ConvertPandoc(dir string, args ...string) (path string, err error) {
pandocBinPath := GetPandocRuntime().BinPath
if "" == pandocBinPath || ContainerStd != Container {
err = ErrPandocNotFound
return
}
pandoc := exec.Command(pandocBinPath, args...)
gulu.CmdAttr(pandoc)
path = filepath.Join("temp", "convert", "pandoc", dir)
absPath := filepath.Join(WorkspaceDir, path)
if err = os.MkdirAll(absPath, 0755); err != nil {
logging.LogErrorf("mkdir [%s] failed: [%s]", absPath, err)
return
}
pandoc.Dir = absPath
output, err := pandoc.CombinedOutput()View on GitHub (pinned to 9f775e8a12)