gastownhall/beads · error

empty executable basename for pid %d

Error message

empty executable basename for pid %d

What it means

On Linux, processExecutableBasename reads the /proc/<pid>/exe symlink target and returns its basename. If the target's basename is '.', the path separator, or empty, it cannot identify the executable, so this error is returned instead of a false verification match.

Source

Thrown at internal/storage/dbproxy/proxy/process_executable_linux.go:24

	"errors"
	"fmt"
	"io/fs"
	"os"
	"path/filepath"
	"strconv"
)

func processExecutableBasename(pid int) (basename string, gone bool, err error) {
	target, err := os.Readlink("/proc/" + strconv.Itoa(pid) + "/exe")
	if err != nil {
		if errors.Is(err, fs.ErrNotExist) {
			return "", true, nil
		}
		return "", false, err
	}
	base := filepath.Base(target)
	if base == "." || base == string(filepath.Separator) || base == "" {
		return "", false, fmt.Errorf("empty executable basename for pid %d", pid)
	}
	return base, false, nil
}

View on GitHub (pinned to 71377f2769)

Solutions

  1. Retry the lookup shortly after; transient /proc state usually resolves
  2. Confirm the process is still alive before verification
  3. Handle the error as 'cannot verify' and treat the stop as unverified rather than fatal
Defensive patterns

Strategy: retry

Validate before calling

if _, err := os.Stat(fmt.Sprintf("/proc/%d", pid)); err != nil { /* pid gone */ }

Type guard

func validBasename(b string) bool { return b != "" && b != "." && b != "/" }

Try / catch

base, exited, err := processExecutableBasename(pid)
if err != nil { /* re-check /proc/<pid> and retry once */ }

Prevention

When it happens

Trigger: Reading /proc/<pid>/exe for a pid whose link target is empty or degenerate — usually the process exited and /proc entry is being torn down, or permission to read the link failed leaving an empty result.

Common situations: Race with process exit during force-stop verification; containerized environments where /proc/<pid>/exe is restricted; pid reuse mid-check.

Related errors


AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30). Data as JSON: /api/errors/0d89984495e1b7dd. Report an issue: GitHub.