{"record":{"id":"b96c03e055448952","repo":"slimtoolkit/slim","slug":"file-is-not-a-binary","errorCode":null,"errorMessage":"file is not a binary","messagePattern":"file is not a binary","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/app/sensor/inspector/sodeps/sodeps.go","lineNumber":19,"sourceCode":"package sodeps\n\nimport (\n\t\"bytes\"\n\t\"errors\"\n\t\"os\"\n\t\"os/exec\"\n\t\"path/filepath\"\n\t\"strings\"\n\n\t\"github.com/slimtoolkit/slim/pkg/app/sensor/detector/binfile\"\n\n\tlog \"github.com/sirupsen/logrus\"\n)\n\n// Inspector errors\nvar (\n\tErrFilePathNotAbs      = errors.New(\"file path is not absolute\")\n\tErrFileNotBin          = errors.New(\"file is not a binary\")\n\tErrDepResolverNotFound = errors.New(\"dependency resolver not found\")\n)\n\nconst (\n\tresolverExeName = \"ldd\"\n)\n\nfunc AllExeDependencies(exeFileName string, find bool) ([]string, error) {\n\tif !strings.HasPrefix(exeFileName, \"/\") {\n\t\tif !find {\n\t\t\treturn nil, ErrFilePathNotAbs\n\t\t}\n\n\t\texePath, err := exec.LookPath(exeFileName)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n","sourceCodeStart":1,"sourceCodeEnd":37,"githubUrl":"https://github.com/slimtoolkit/slim/blob/81940d17fa112cc678e32209214bcb2355cb3004/pkg/app/sensor/inspector/sodeps/sodeps.go#L1-L37","documentation":"ErrFileNotBin is returned by sodeps.AllDependencies when the binfile.Detected check indicates the target file is not a binary (executable or shared object). ldd-based dependency resolution only makes sense on ELF binaries, so the inspector rejects anything else up front.","triggerScenarios":"Calling AllDependencies (or AllExeDependencies after path resolution) on a script (#!/bin/sh), a text/config file, a symlink target that is not a binary, or a corrupted/statically-unrecognizable file.","commonSituations":"Pointing the sensor at an interpreted app (Python/Node scripts) instead of its interpreter binary; app_name resolves to a shell wrapper; inspecting data files by mistake.","solutions":["Point the API at the actual ELF executable or .so file (e.g., /usr/bin/python3 rather than the script)","Verify the file with 'file <path>' — it should report ELF executable or shared object","If the binary is packed or unrecognized, check binfile.Detected behavior or inspect dependencies differently","Fix app_name/app_entrypoint config so it targets the real binary, not a wrapper script"],"exampleFix":"// before\ndeps, err := sodeps.AllDependencies(\"/app/run.sh\")\n// after\ndeps, err := sodeps.AllDependencies(\"/bin/sh\") // or the real ELF binary that runs your app","handlingStrategy":"validation","validationCode":"// Go: check the file is an ELF binary before dependency inspection\nprops, err := binfile.Detected(binPath)\nif err != nil || props == nil || !props.IsBin {\n    return fmt.Errorf(\"%s is not a binary\", binPath)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run 'file <path>' (or binfile.Detected) before dependency analysis","Point inspection at real ELF executables/shared objects, not scripts or wrappers","Resolve interpreted entrypoints to their interpreter binary"],"tags":["validation","binary","dependency-inspection","go"],"backgroundTag":"not-an-elf-binary","analyzedSha":"81940d17fa112cc678e32209214bcb2355cb3004","analyzedAt":"2026-08-31T23:06:12.682Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}