AdguardTeam/AdGuardHome · error

getting executable path: %v

Error message

getting executable path: %v

What it means

In the macOS-only pre-flight check before starting the service, os.Executable failed, so the running binary's own path could not be determined. The %v (not %w) wrap means the underlying error is only visible in text, not unwrappable.

Source

Thrown at internal/aghos/service_darwin.go:19

//go:build darwin

package aghos

import (
	"fmt"
	"os"
	"path/filepath"
	"strings"

	"github.com/AdguardTeam/golibs/log"
)

// preCheckActionStart performs the service start action pre-check.  It warns
// user that the service should be installed into Applications directory.
func preCheckActionStart() (err error) {
	exe, err := os.Executable()
	if err != nil {
		return fmt.Errorf("getting executable path: %v", err)
	}

	exe, err = filepath.EvalSymlinks(exe)
	if err != nil {
		return fmt.Errorf("evaluating executable symlinks: %v", err)
	}

	if !strings.HasPrefix(exe, "/Applications/") {
		log.Info("warning: service must be started from within the /Applications directory")
	}

	return err
}

View on GitHub (pinned to b41aefbe51)

Solutions

  1. Reinstall/re-copy the binary to /Applications so its executable path is resolvable, then start again
  2. Avoid deleting or overwriting the running binary; stop the service before upgrades
  3. Relaunch from a stable absolute path rather than a transient one
Defensive patterns

Strategy: validation

Validate before calling

if _, err := os.Executable(); err != nil { /* refuse to start; binary path unresolvable */ }

Prevention

When it happens

Trigger: Calling the service start action on macOS when os.Executable returns an error — the binary was deleted or replaced while running (proc path gone), /proc/self/exe-equivalent read failure, or unusual launch environments that break executable resolution.

Common situations: Replacing an AdGuardHome binary in place and restarting from a half-deleted state; launching via symlinks through deleted paths; sandboxed launchers blocking executable introspection.

Related errors


AI-assisted analysis of AdguardTeam/AdGuardHome@b41aefbe51 (2026-08-27). Data as JSON: /api/errors/78f48d0726d30707. Report an issue: GitHub.