{"record":{"id":"ceb57547dc661ebb","repo":"go-delve/delve","slug":"v-is-not-a-core-file","errorCode":null,"errorMessage":"%v is not a core file","messagePattern":"(.+?) is not a core file","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/proc/core/linux_core.go","lineNumber":122,"sourceCode":"// readLinuxOrPlatformIndependentCore reads a core file from corePath\n// corresponding to the executable at exePath. For details on the Linux ELF\n// core format, see:\n// https://www.gabriel.urdhr.fr/2015/05/29/core-file/,\n// https://uhlo.blogspot.com/2012/05/brief-look-into-core-dumps.html,\n// elf_core_dump in https://elixir.bootlin.com/linux/v4.20.17/source/fs/binfmt_elf.c,\n// and, if absolutely desperate, readelf.c from the binutils source.\nfunc readLinuxOrPlatformIndependentCore(corePath, exePath string) (*process, proc.Thread, error) {\n\tcoreFile, err := elf.Open(corePath)\n\tif err != nil {\n\t\tif _, isfmterr := err.(*elf.FormatError); isfmterr && (strings.Contains(err.Error(), elfErrorBadMagicNumber) || strings.Contains(err.Error(), \" at offset 0x0: too short\")) {\n\t\t\t// Go >=1.11 and <1.11 produce different errors when reading a non-elf file.\n\t\t\treturn nil, nil, ErrUnrecognizedFormat\n\t\t}\n\t\treturn nil, nil, err\n\t}\n\n\tif coreFile.Type != elf.ET_CORE {\n\t\treturn nil, nil, fmt.Errorf(\"%v is not a core file\", coreFile)\n\t}\n\n\tmachineType := coreFile.Machine\n\tnotes, platformIndependentDelveCore, err := readNotes(coreFile, machineType)\n\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 {","sourceCodeStart":104,"sourceCodeEnd":140,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/pkg/proc/core/linux_core.go#L104-L140","documentation":"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.","triggerScenarios":"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.","commonSituations":"Swapping the executable and core arguments by mistake; passing a stripped binary where the core was expected; a build artifact instead of a dump.","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."],"exampleFix":"// before (swapped args)\ndlv core ./core ./myapp\n// after\ndlv core ./myapp ./core","handlingStrategy":"validation","validationCode":"f, err := elf.Open(path)\nif err != nil { return err }\nif f.Type != elf.ET_CORE {\n\treturn fmt.Errorf(\"%s is ET_%s, not a core file\", path, f.Type)\n}","typeGuard":"func isCoreELF(path string) bool {\n\tf, err := elf.Open(path)\n\tif err != nil { return false }\n\tdefer f.Close()\n\treturn f.Type == elf.ET_CORE\n}","tryCatchPattern":"p, err := core.ReadFile(exePath, corePath)\nif err != nil {\n\tif strings.Contains(err.Error(), \"is not a core file\") {\n\t\treturn fmt.Errorf(\"check argument order: usage is 'dlv core <executable> <core>'\")\n\t}\n\treturn err\n}","preventionTips":["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."],"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-31T22:30:34.772Z"}