{"record":{"id":"d680a72efb6fd850","repo":"go-delve/delve","slug":"short-read","errorCode":null,"errorMessage":"short read","messagePattern":"short read","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"pkg/proc/core/core.go","lineNumber":187,"sourceCode":"// thread represents a thread in the core file being debugged.\ntype thread struct {\n\tosThread\n\tp      *process\n\tcommon proc.CommonThread\n}\n\ntype osThread interface {\n\tRegisters() (proc.Registers, error)\n\tThreadID() int\n}\n\nvar (\n\t// ErrWriteCore is returned when attempting to write to the core\n\t// process memory.\n\tErrWriteCore = errors.New(\"can not write to core process\")\n\n\t// ErrShortRead is returned on a short read.\n\tErrShortRead = errors.New(\"short read\")\n\n\t// ErrContinueCore is returned when trying to continue execution of a core process.\n\tErrContinueCore = errors.New(\"can not continue execution of core process\")\n\n\t// ErrChangeRegisterCore is returned when trying to change register values for core files.\n\tErrChangeRegisterCore = errors.New(\"can not change register values of core process\")\n)\n\ntype openFn func(string, string) (*process, proc.Thread, error)\n\nvar openFns = []openFn{readLinuxOrPlatformIndependentCore, readAMD64Minidump}\n\n// ErrUnrecognizedFormat is returned when the core file is not recognized as\n// any of the supported formats.\nvar ErrUnrecognizedFormat = errors.New(\"unrecognized core format\")\n\n// OpenCore will open the core file and return a *proc.TargetGroup.\n// If the DWARF information cannot be found in the binary, Delve will look","sourceCodeStart":169,"sourceCodeEnd":205,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/pkg/proc/core/core.go#L169-L205","documentation":"ErrShortRead is a sentinel error (pkg/proc/core/core.go:187) returned by the core-dump backend's ReadMemory when fewer bytes were read from the core file than requested. A core file only contains pages that were resident at dump time, so reads that span un-mapped or un-dumped regions come back short. It signals that the memory image is incomplete, not that the debugger itself failed.","triggerScenarios":"Calling ReadMemory (directly or via variable evaluation) on a *proc.TargetGroup opened with OpenCore when the requested address range extends past the end of a PT_LOAD segment or into a region not present in the core file.","commonSituations":"Inspecting variables that live in pages not captured by the core dump (e.g. kernel-trimmed /proc/sys/vm/core_filter dumps), evaluating a string/struct that straddles a dumped/un-dumped boundary, using a truncated or partially downloaded core file, or a stripped core produced with a reduced RLIMIT_CORE.","solutions":["Verify the core file is complete and was produced with full memory capture (unlimited RLIMIT_CORE, no core_filter trimming) and re-dump if needed.","Read smaller memory ranges and treat short reads as expected for un-dumped regions instead of full-struct reads.","Open the correct executable (exePath) so Delve resolves variable sizes/addresses consistently with the core.","If the data genuinely must be available, switch to a live debug session (dlv attach / dlv exec) instead of core analysis."],"exampleFix":"// before: assume full struct read succeeds on a core\nbuf := make([]byte, size)\nn, err := mem.ReadMemory(buf, addr) // err = short read\n\n// after: tolerate short reads on core dumps\nn, err := mem.ReadMemory(buf, addr)\nif errors.Is(err, proc.ErrShortRead) && n > 0 {\n    // use the n bytes that were available\n}","handlingStrategy":"fallback","validationCode":"n, err := mem.ReadMemory(buf, addr)\nif err != nil && !errors.Is(err, proc.ErrShortRead) { return err }","typeGuard":"func isShortRead(err error) bool { return errors.Is(err, proc.ErrShortRead) }","tryCatchPattern":"n, err := mem.ReadMemory(buf, addr)\nswitch {\ncase err == nil:\n    use(buf[:n])\ncase errors.Is(err, proc.ErrShortRead) && n > 0:\n    use(buf[:n]) // partial data from un-dumped region\ncase errors.Is(err, proc.ErrShortRead):\n    skip(addr) // region entirely absent from core\ndefault:\n    return err\n}","preventionTips":["Capture cores with full memory (ulimit -c unlimited, no core filtering).","Verify core file integrity after transfer (size + checksum).","Keep the exact matching executable available to OpenCore.","Design inspectors to tolerate missing pages rather than failing whole evaluations."],"tags":["core-dump","memory-read","go","delve"],"backgroundTag":"core-dump-short-read","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}