owasp-amass/amass · error

failed to get executable path: %w

Error message

failed to get executable path: %w

What it means

startEngine calls os.Executable() to locate the current binary so it can relaunch it as the engine process. If the OS cannot determine the executable path, the error is wrapped with this message and returned.

Source

Thrown at cmd/amass/process.go:33

)

func engineIsRunning() bool {
	c, err := client.NewClient("http://127.0.0.1:4000")
	if err != nil {
		return false
	}
	defer c.Close()

	ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second)
	defer cancel()

	return c.HealthCheck(ctx)
}

func startEngine() error {
	p, err := os.Executable()
	if err != nil {
		return fmt.Errorf("failed to get executable path: %w", err)
	}
	if p == "" {
		return fmt.Errorf("executable path is empty")
	}

	cmd := initCmd(p)
	if cmd == nil {
		return fmt.Errorf("failed to initialize command for %s", p)
	}
	cmd.Stdout = io.Discard
	cmd.Stderr = io.Discard
	cmd.Stdin = os.Stdin

	cmd.Dir, err = os.Getwd()
	if err != nil {
		return err
	}

View on GitHub (pinned to 79299dce87)

Solutions

  1. Ensure the amass binary still exists on disk at the path it was launched from (don't delete/replace it while running).
  2. Run in an environment where /proc is available and the executable path is resolvable.
  3. Inspect the wrapped %w error for the OS-level cause and address that (permissions, mount, filesystem).
Defensive patterns

Strategy: fallback

Validate before calling

if _, err := os.Executable(); err != nil {
    // resolve fallback path or abort before calling startEngine
}

Try / catch

if err := startEngine(); err != nil {
    if strings.HasPrefix(err.Error(), "failed to get executable path") {
        log.Fatalf("cannot locate running binary: %v — reinstall or launch from a stable path", err)
    }
}

Prevention

When it happens

Trigger: os.Executable() failing due to a deleted binary (/proc/self/exe gone), unusual runtime environments, or platform failures resolving the process image path.

Common situations: Running the binary from a tmpfs/overlay that was cleaned up while the process runs; executing via deleted in-place upgrades; exotic sandboxes where /proc is not mounted.

Related errors


AI-assisted analysis of owasp-amass/amass@79299dce87 (2026-09-06). Data as JSON: /api/errors/3c8d262ea341b7de. Report an issue: GitHub.