anomalyco/sst · warning
no ELF interpreter found for %s
Error message
no ELF interpreter found for %s
What it means
elfInterpreter reads the PT_INTERP segment of an ELF binary to find its dynamic loader path (used by muslFromELF to detect musl vs glibc, e.g. for Alpine bun builds). If the file is not a dynamically linked ELF (no interpreter program header), it returns this error with the file path.
Source
Thrown at pkg/global/bun.go:263
file, err := elf.Open(path)
if err != nil {
return "", err
}
defer file.Close()
for _, prog := range file.Progs {
if prog.Type != elf.PT_INTERP {
continue
}
interpreter, err := io.ReadAll(prog.Open())
if err != nil {
return "", err
}
return strings.TrimRight(string(interpreter), "\x00"), nil
}
return "", fmt.Errorf("no ELF interpreter found for %s", path)
}
View on GitHub (pinned to a0bd20f762)
Solutions
- Only call this for Linux ELF executables; check magic bytes (\x7fELF) first
- Handle the error as 'static binary / not ELF' and fall back to another detection method (e.g. ldd or /etc/os-release)
- Verify the path points to the actual executable
Example fix
// before
interp, err := elfInterpreter(binPath)
// after
if runtime.GOOS != "linux" {
return "", nil // not ELF; skip musl detection
}
interp, err := elfInterpreter(binPath)
if err != nil { return "", nil } // static or non-ELF: use default loader Defensive patterns
Strategy: type-guard
Validate before calling
f, err := os.Open(path)
if err != nil { return err }
defer f.Close()
magic := make([]byte, 4)
if _, err := io.ReadFull(f, magic); err != nil { return err }
if !bytes.Equal(magic, []byte{0x7f, 'E', 'L', 'F'}) {
return fmt.Errorf("%s is not an ELF binary", path)
} Type guard
func isELF(path string) bool {
f, err := os.Open(path)
if err != nil { return false }
defer f.Close()
var hdr [4]byte
if _, err := io.ReadFull(f, hdr[:]); err != nil { return false }
return hdr == [4]byte{0x7f, 'E', 'L', 'F'}
} Try / catch
interp, err := elfInterpreter(path)
if err != nil {
if strings.HasPrefix(err.Error(), "no ELF interpreter") {
// static binary or non-ELF: assume glibc/default loader
return "", nil
}
return "", err
} Prevention
- Check the \x7fELF magic before parsing program headers
- Treat static binaries and non-Linux executables as 'no interpreter' rather than fatal
- Verify the path targets the executable, not a script or library
When it happens
Trigger: Calling muslFromELF on a statically linked binary, a non-ELF file (Mach-O on macOS, PE on Windows, shell script), or a corrupted/truncated executable at the given path.
Common situations: Platform detection on macOS/Windows hosts where the binary isn't ELF; inspecting a static musl binary (which has no PT_INTERP); pointing the function at the wrong file (a library or script instead of the executable).
AI-assisted analysis of anomalyco/sst@a0bd20f762 (2026-08-30).
Data as JSON: /api/errors/05c2d7c5f247bdf9.
Report an issue: GitHub.