go-delve/delve · warning

short read

Error message

short read

What it means

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.

Source

Thrown at pkg/proc/core/core.go:187

// thread represents a thread in the core file being debugged.
type thread struct {
	osThread
	p      *process
	common proc.CommonThread
}

type osThread interface {
	Registers() (proc.Registers, error)
	ThreadID() int
}

var (
	// ErrWriteCore is returned when attempting to write to the core
	// process memory.
	ErrWriteCore = errors.New("can not write to core process")

	// ErrShortRead is returned on a short read.
	ErrShortRead = errors.New("short read")

	// ErrContinueCore is returned when trying to continue execution of a core process.
	ErrContinueCore = errors.New("can not continue execution of core process")

	// ErrChangeRegisterCore is returned when trying to change register values for core files.
	ErrChangeRegisterCore = errors.New("can not change register values of core process")
)

type openFn func(string, string) (*process, proc.Thread, error)

var openFns = []openFn{readLinuxOrPlatformIndependentCore, readAMD64Minidump}

// ErrUnrecognizedFormat is returned when the core file is not recognized as
// any of the supported formats.
var ErrUnrecognizedFormat = errors.New("unrecognized core format")

// OpenCore will open the core file and return a *proc.TargetGroup.
// If the DWARF information cannot be found in the binary, Delve will look

View on GitHub (pinned to a23773e6c3)

Solutions

  1. 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.
  2. Read smaller memory ranges and treat short reads as expected for un-dumped regions instead of full-struct reads.
  3. Open the correct executable (exePath) so Delve resolves variable sizes/addresses consistently with the core.
  4. If the data genuinely must be available, switch to a live debug session (dlv attach / dlv exec) instead of core analysis.

Example fix

// before: assume full struct read succeeds on a core
buf := make([]byte, size)
n, err := mem.ReadMemory(buf, addr) // err = short read

// after: tolerate short reads on core dumps
n, err := mem.ReadMemory(buf, addr)
if errors.Is(err, proc.ErrShortRead) && n > 0 {
    // use the n bytes that were available
}
Defensive patterns

Strategy: fallback

Validate before calling

n, err := mem.ReadMemory(buf, addr)
if err != nil && !errors.Is(err, proc.ErrShortRead) { return err }

Type guard

func isShortRead(err error) bool { return errors.Is(err, proc.ErrShortRead) }

Try / catch

n, err := mem.ReadMemory(buf, addr)
switch {
case err == nil:
    use(buf[:n])
case errors.Is(err, proc.ErrShortRead) && n > 0:
    use(buf[:n]) // partial data from un-dumped region
case errors.Is(err, proc.ErrShortRead):
    skip(addr) // region entirely absent from core
default:
    return err
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of go-delve/delve@a23773e6c3 (2026-08-31). Data as JSON: /api/errors/d680a72efb6fd850. Report an issue: GitHub.