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
- Retry the lookup shortly after; transient /proc state usually resolves
- Confirm the process is still alive before verification
- 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
- Expect /proc races when processes are exiting
- Verify /proc/<pid>/exe is readable in your container/security context
- Treat as 'unverified' rather than aborting the whole stop
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
- procid: malformed proc stat: missing comm terminator
- procid: malformed proc stat: missing starttime
- procid: malformed proc stat starttime: %w
- capture proxy birth identity: %w
- read cmdline for pid %d: %w
AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30).
Data as JSON: /api/errors/0d89984495e1b7dd.
Report an issue: GitHub.