siyuan-note/siyuan · warning

not found elevator [%s]

Error message

not found elevator [%s]

What it means

Logged and returned by AddMicrosoftDefenderExclusion when the elevator binary (elevator.exe) is not found at the expected path. The elevator is a small helper that runs with admin privileges (ShellExecute 'runas') to add the SiYuan install/workspace paths to Windows Defender's exclusion list. Without it, Defender may scan and lock SiYuan's files, degrading performance.

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 251596fc0d)

Solutions

  1. If running in production, reinstall SiYuan from the official package which includes the elevator binary for your architecture.
  2. If building from source, ensure the elevator is compiled and placed at kernel/elevator.exe or elevator/elevator-<GOARCH>.exe.
  3. If Defender exclusion isn't critical, this warning is safe to ignore — SiYuan will still run, just potentially slower under active scans.
Defensive patterns

Strategy: fallback

Try / catch

if err := model.AddMicrosoftDefenderExclusion(); err != nil {
    if strings.Contains(err.Error(), "not found elevator") {
        // non-fatal — SiYuan runs without Defender exclusion, just slower under scans
        logging.LogWarnf("elevator not found, skipping Defender exclusion: %v", err)
    }
}

Prevention

When it happens

Trigger: AddMicrosoftDefenderExclusion runs on Windows startup/first-run but the elevator.exe is missing from both util.WorkingDir/kernel/elevator.exe and util.WorkingDir/elevator/elevator-<GOARCH>.exe. Common in development builds ('dev' mode) or incomplete installations where the elevator wasn't packaged.

Common situations: Running from source in dev mode (elevator not built). Portable/custom install that didn't include the elevator binary. Antivirus quarantined elevator.exe. Wrong GOARCH build (e.g., 386 elevator on an amd64 install).

Related errors


AI-assisted analysis of siyuan-note/siyuan@251596fc0d (2026-08-12). Data as JSON: /api/errors/88e48bdda1e1c076. Report an issue: GitHub.