{"record":{"id":"825948dfdd34ad5b","repo":"go-delve/delve","slug":"v-is-not-an-exe-file","errorCode":null,"errorMessage":"%v is not an exe file","messagePattern":"(.+?) is not an exe file","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/proc/core/linux_core.go","lineNumber":145,"sourceCode":"\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\texe, err := os.Open(exePath)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\texeELF, err := elf.NewFile(exe)\n\tif err != nil {\n\t\tif !platformIndependentDelveCore {\n\t\t\treturn nil, nil, err\n\t\t}\n\t} else {\n\t\tif exeELF.Machine != machineType {\n\t\t\treturn nil, nil, fmt.Errorf(\"architecture mismatch between core file (%#x) and executable file (%#x)\", machineType, exeELF.Machine)\n\t\t}\n\t\tif exeELF.Type != elf.ET_EXEC && exeELF.Type != elf.ET_DYN {\n\t\t\treturn nil, nil, fmt.Errorf(\"%v is not an exe file\", exeELF)\n\t\t}\n\t}\n\n\tmemory := buildMemory(coreFile, exeELF, exe, notes)\n\n\t// TODO support 386\n\tvar bi *proc.BinaryInfo\n\tif platformIndependentDelveCore {\n\t\tgoos, goarch, err := platformFromNotes(notes)\n\t\tif err != nil {\n\t\t\treturn nil, nil, err\n\t\t}\n\t\tbi = proc.NewBinaryInfo(goos, goarch)\n\t} else if goarch, ok := supportedLinuxMachines[machineType]; ok {\n\t\tbi = proc.NewBinaryInfo(\"linux\", goarch)\n\t} else {\n\t\treturn nil, nil, errors.New(\"unsupported machine type\")\n\t}","sourceCodeStart":127,"sourceCodeEnd":163,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/pkg/proc/core/linux_core.go#L127-L163","documentation":"The executable paired with a core must be a loadable ELF image: e_type must be ET_EXEC or ET_DYN. Relocatable objects (ET_REL), core files, or other ELF types passed as the executable are rejected with this error naming the file.","triggerScenarios":"readLinuxOrPlatformIndependentCore: the machine type matched, but exeELF.Type is neither elf.ET_EXEC nor elf.ET_DYN — e.g. a .o object file or another core dump was passed as the executable argument.","commonSituations":"Passing a compiled package archive/object instead of the linked binary; accidentally passing the core as the executable; using a partially linked artifact from the build directory.","solutions":["Pass the fully linked executable (as built by 'go build'), not an object or archive.","Verify with 'file <exe>' that it reports 'ELF 64-bit ... executable' or 'pie executable'.","Ensure argument order is <executable> <core>.","Rebuild the binary if it was stripped/transformed into a non-executable form."],"exampleFix":"// before\ndlv core ./pkg/foo.o ./core\n// after\ndlv core ./myapp ./core  # linked executable","handlingStrategy":"validation","validationCode":"e, err := elf.Open(exePath)\nif err != nil { return err }\nif e.Type != elf.ET_EXEC && e.Type != elf.ET_DYN {\n\treturn fmt.Errorf(\"%s is ET_%s; pass the linked executable\", exePath, e.Type)\n}","typeGuard":"func isExecutableELF(path string) bool {\n\te, err := elf.Open(path)\n\tif err != nil { return false }\n\tdefer e.Close()\n\treturn e.Type == elf.ET_EXEC || e.Type == elf.ET_DYN\n}","tryCatchPattern":"p, err := core.ReadFile(exePath, corePath)\nif err != nil && strings.Contains(err.Error(), \"is not an exe file\") {\n\treturn fmt.Errorf(\"pass the fully linked binary (go build output), not an object/archive\")\n}","preventionTips":["Always use the binary produced by 'go build', verified with 'file'.","Confirm argument order <executable> <core>.","Avoid passing .o/.a artifacts or second core files as the exe.","Keep the exact binary (with matching build ID) next to the core."],"tags":["core-dump","elf-format","wrong-file-type"],"backgroundTag":"not-a-core-file","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}