{"record":{"id":"05c2d7c5f247bdf9","repo":"anomalyco/sst","slug":"no-elf-interpreter-found-for-s","errorCode":null,"errorMessage":"no ELF interpreter found for %s","messagePattern":"no ELF interpreter found for (.+?)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"pkg/global/bun.go","lineNumber":263,"sourceCode":"\tfile, err := elf.Open(path)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tdefer file.Close()\n\n\tfor _, prog := range file.Progs {\n\t\tif prog.Type != elf.PT_INTERP {\n\t\t\tcontinue\n\t\t}\n\n\t\tinterpreter, err := io.ReadAll(prog.Open())\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\treturn strings.TrimRight(string(interpreter), \"\\x00\"), nil\n\t}\n\n\treturn \"\", fmt.Errorf(\"no ELF interpreter found for %s\", path)\n}\n","sourceCodeStart":245,"sourceCodeEnd":265,"githubUrl":"https://github.com/anomalyco/sst/blob/a0bd20f762883e72a35caccb4896c42ce5b3f707/pkg/global/bun.go#L245-L265","documentation":"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.","triggerScenarios":"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.","commonSituations":"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).","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"],"exampleFix":"// before\ninterp, err := elfInterpreter(binPath)\n// after\nif runtime.GOOS != \"linux\" {\n    return \"\", nil // not ELF; skip musl detection\n}\ninterp, err := elfInterpreter(binPath)\nif err != nil { return \"\", nil } // static or non-ELF: use default loader","handlingStrategy":"type-guard","validationCode":"f, err := os.Open(path)\nif err != nil { return err }\ndefer f.Close()\nmagic := make([]byte, 4)\nif _, err := io.ReadFull(f, magic); err != nil { return err }\nif !bytes.Equal(magic, []byte{0x7f, 'E', 'L', 'F'}) {\n    return fmt.Errorf(\"%s is not an ELF binary\", path)\n}","typeGuard":"func isELF(path string) bool {\n    f, err := os.Open(path)\n    if err != nil { return false }\n    defer f.Close()\n    var hdr [4]byte\n    if _, err := io.ReadFull(f, hdr[:]); err != nil { return false }\n    return hdr == [4]byte{0x7f, 'E', 'L', 'F'}\n}","tryCatchPattern":"interp, err := elfInterpreter(path)\nif err != nil {\n    if strings.HasPrefix(err.Error(), \"no ELF interpreter\") {\n        // static binary or non-ELF: assume glibc/default loader\n        return \"\", nil\n    }\n    return \"\", err\n}","preventionTips":["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"],"tags":["elf","linux","platform-detection"],"backgroundTag":"elf-interpreter-not-found","analyzedSha":"a0bd20f762883e72a35caccb4896c42ce5b3f707","analyzedAt":"2026-08-30T11:26:00.383Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}