go-delve/delve · error
%v is not a core file
Error message
%v is not a core file
What it means
readLinuxOrPlatformIndependentCore opens the file as an ELF and requires e_type == ET_CORE. A valid ELF file whose type is not a core dump (ET_EXEC, ET_DYN, ET_REL) is rejected with this error naming the file. This is a format gate before any note parsing.
Source
Thrown at pkg/proc/core/linux_core.go:122
// readLinuxOrPlatformIndependentCore reads a core file from corePath
// corresponding to the executable at exePath. For details on the Linux ELF
// core format, see:
// https://www.gabriel.urdhr.fr/2015/05/29/core-file/,
// https://uhlo.blogspot.com/2012/05/brief-look-into-core-dumps.html,
// elf_core_dump in https://elixir.bootlin.com/linux/v4.20.17/source/fs/binfmt_elf.c,
// and, if absolutely desperate, readelf.c from the binutils source.
func readLinuxOrPlatformIndependentCore(corePath, exePath string) (*process, proc.Thread, error) {
coreFile, err := elf.Open(corePath)
if err != nil {
if _, isfmterr := err.(*elf.FormatError); isfmterr && (strings.Contains(err.Error(), elfErrorBadMagicNumber) || strings.Contains(err.Error(), " at offset 0x0: too short")) {
// Go >=1.11 and <1.11 produce different errors when reading a non-elf file.
return nil, nil, ErrUnrecognizedFormat
}
return nil, nil, err
}
if coreFile.Type != elf.ET_CORE {
return nil, nil, fmt.Errorf("%v is not a core file", coreFile)
}
machineType := coreFile.Machine
notes, platformIndependentDelveCore, err := readNotes(coreFile, machineType)
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 {View on GitHub (pinned to a23773e6c3)
Solutions
- Check argument order: the core file must be the core dump, not the executable.
- Run 'file <path>' to confirm it reports 'ELF ... core file'.
- If no core exists, generate one (ulimit -c unlimited, or dlv's core facilities).
- Do not pass a PIE/ET_EXEC binary to the core loader.
Example fix
// before (swapped args) dlv core ./core ./myapp // after dlv core ./myapp ./core
Defensive patterns
Strategy: validation
Validate before calling
f, err := elf.Open(path)
if err != nil { return err }
if f.Type != elf.ET_CORE {
return fmt.Errorf("%s is ET_%s, not a core file", path, f.Type)
} Type guard
func isCoreELF(path string) bool {
f, err := elf.Open(path)
if err != nil { return false }
defer f.Close()
return f.Type == elf.ET_CORE
} Try / catch
p, err := core.ReadFile(exePath, corePath)
if err != nil {
if strings.Contains(err.Error(), "is not a core file") {
return fmt.Errorf("check argument order: usage is 'dlv core <executable> <core>'")
}
return err
} Prevention
- Run 'file <path>' before loading; expect 'core file'.
- Keep executable and core arguments in the documented order.
- Never point the core argument at a binary or build artifact.
- Generate cores with ulimit -c unlimited or delve's dump support.
When it happens
Trigger: Calling the core-loading path (e.g. dlv core <exe> <file>, or debugger API LoadCore) with a file that is an ELF executable or object rather than a core dump.
Common situations: Swapping the executable and core arguments by mistake; passing a stripped binary where the core was expected; a build artifact instead of a dump.
Related errors
- %v is not an exe 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/ceb57547dc661ebb.
Report an issue: GitHub.