go-delve/delve · error
%v is not an exe file
Error message
%v is not an exe file
What it means
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.
Source
Thrown at pkg/proc/core/linux_core.go:145
if err != nil {
return nil, nil, err
}
exe, err := os.Open(exePath)
if err != nil {
return nil, nil, err
}
exeELF, err := elf.NewFile(exe)
if err != nil {
if !platformIndependentDelveCore {
return nil, nil, err
}
} else {
if exeELF.Machine != machineType {
return nil, nil, fmt.Errorf("architecture mismatch between core file (%#x) and executable file (%#x)", machineType, exeELF.Machine)
}
if exeELF.Type != elf.ET_EXEC && exeELF.Type != elf.ET_DYN {
return nil, nil, fmt.Errorf("%v is not an exe file", exeELF)
}
}
memory := buildMemory(coreFile, exeELF, exe, notes)
// TODO support 386
var bi *proc.BinaryInfo
if platformIndependentDelveCore {
goos, goarch, err := platformFromNotes(notes)
if err != nil {
return nil, nil, err
}
bi = proc.NewBinaryInfo(goos, goarch)
} else if goarch, ok := supportedLinuxMachines[machineType]; ok {
bi = proc.NewBinaryInfo("linux", goarch)
} else {
return nil, nil, errors.New("unsupported machine type")
}View on GitHub (pinned to a23773e6c3)
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.
Example fix
// before dlv core ./pkg/foo.o ./core // after dlv core ./myapp ./core # linked executable
Defensive patterns
Strategy: validation
Validate before calling
e, err := elf.Open(exePath)
if err != nil { return err }
if e.Type != elf.ET_EXEC && e.Type != elf.ET_DYN {
return fmt.Errorf("%s is ET_%s; pass the linked executable", exePath, e.Type)
} Type guard
func isExecutableELF(path string) bool {
e, err := elf.Open(path)
if err != nil { return false }
defer e.Close()
return e.Type == elf.ET_EXEC || e.Type == elf.ET_DYN
} Try / catch
p, err := core.ReadFile(exePath, corePath)
if err != nil && strings.Contains(err.Error(), "is not an exe file") {
return fmt.Errorf("pass the fully linked binary (go build output), not an object/archive")
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- %v is not a core file
- architecture mismatch between core file (%#x) and executable
- short read
- can not continue execution of core process
- can not change register values of core process
AI-assisted analysis of go-delve/delve@a23773e6c3 (2026-08-31).
Data as JSON: /api/errors/825948dfdd34ad5b.
Report an issue: GitHub.