siyuan-note/siyuan · warning
not found elevator [ ]
Error message
not found elevator [%s]
What it means
AddMicrosoftDefenderExclusion elevates via a helper executable ('elevator') to add the install path and workspace dir to Windows Defender exclusions. Before invoking it, the function checks gulu.File.IsExist(elevator); if the bundled elevator binary is missing it logs a warning, constructs 'not found elevator [%s]', and returns that error. This is a fail-fast guard so the caller does not attempt an unauthorized command with a non-existent helper.
Solutions
- Verify the elevator executable exists next to the SiYuan installation (reinstall/repair SiYuan to restore it).
- Check antivirus quarantine logs and whitelist/restore the elevator binary, then retry.
- Run SiYuan from the correct working directory (util.WorkingDir) so the relative elevator path resolves; avoid launching the binary directly from an unrelated cwd.
- If you do not need Defender exclusions, skip the call — this error is non-fatal to the app itself (logged as a warning).
Example fix
// before: elevator path resolved from an unexpected cwd -> "not found elevator [elevator.exe]" // after: launch from the install directory so the helper resolves // cd C:\Path\To\SiYuan; SiYuan.exe (or repair the installation so the elevator binary exists)
Defensive patterns
Strategy: fallback
Validate before calling
// Go: probe the elevator before requesting the exclusion
if !gulu.File.IsExist(elevatorPath) {
log.Warn("Defender exclusion skipped: elevator binary missing")
return nil // or surface a repair hint to the user
} Try / catch
if err := AddMicrosoftDefenderExclusion(); err != nil {
logging.LogWarnf("Defender exclusion skipped: %v", err) // non-fatal; app continues
} Prevention
- Install SiYuan via the official installer so the elevator binary ships with the app
- Whitelist the install directory in AV software to prevent quarantine of the elevation helper
- Do not move or rename the installation folder after install
- Treat this failure as non-fatal: log and continue rather than blocking startup
When it happens
Trigger: Calling AddMicrosoftDefenderExclusion on Windows when the elevator executable's expected path (resolved relative to util.WorkingDir) does not exist — typically because the installation is incomplete/corrupted, the binary was removed by antivirus or cleanup tools, or the working directory is wrong (e.g. running from a dev build or portable layout lacking the elevator file).
Common situations: Windows setup where Defender or another AV quarantined the elevation helper; portable/dev checkout without the packaged elevator binary; broken or moved installation directory so the relative path no longer resolves; running the kernel outside the normal installed layout.
Understand the failure class
Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.
Related errors
- automatic proxy configuration is not supported
- automatic proxy detection is not supported
- Conf.Language(387)
- open clipboard timeout
- path contains invalid character
AI-assisted analysis of siyuan-note/siyuan@9f775e8a12 (2026-09-19).
Data as JSON: /api/errors/88e48bdda1e1c076.
Report an issue: GitHub.
Appendix: source
Thrown at kernel/model/elevator_windows.go:65
}
if !isUsingMicrosoftDefender() {
return
}
elevator := getElevatorBin()
if !gulu.File.IsExist(elevator) {
logging.LogWarnf("not found elevator [%s]", elevator)
return
}
installPath := filepath.Dir(util.WorkingDir)
logging.LogInfof("use elevator to add Windows Defender exclusion path [%s, %s]", installPath, util.WorkspaceDir)
if !gulu.File.IsExist(elevator) {
msg := fmt.Sprintf("not found elevator [%s]", elevator)
logging.LogWarn(msg)
err = errors.New(msg)
return
}
// 工作空间路径由用户自由指定,这里校验并转义,避免路径中的 cmd.exe 元字符导致提权后命令注入
if err = validateExclusionPath(installPath); nil != err {
logging.LogWarnf("invalid Windows Defender exclusion path [%s]: %s", installPath, err)
return
}
if err = validateExclusionPath(util.WorkspaceDir); nil != err {
logging.LogWarnf("invalid Windows Defender exclusion path [%s]: %s", util.WorkspaceDir, err)
return
}
ps := []string{"add-defender-exclusion", syscall.EscapeArg(installPath), syscall.EscapeArg(util.WorkspaceDir)}
verbPtr, _ := syscall.UTF16PtrFromString("runas")
exePtr, _ := syscall.UTF16PtrFromString(elevator)
cwdPtr, _ := syscall.UTF16PtrFromString(util.WorkingDir)
argPtr, _ := syscall.UTF16PtrFromString(strings.Join(ps, " "))View on GitHub (pinned to 9f775e8a12)