go-delve/delve · error

minidump %s truncated at offset %#x while %s

Error message

minidump %s truncated at offset %#x while %s

What it means

minidumpBuf.u16 reads a little-endian uint16 from the minidump buffer, setting buf.err with this message when fewer than 2 bytes remain at the current offset (the `stride` guard uses >=, triggering one byte early). Delve throws it while walking Windows minidump structures when the file is shorter than the structures claim. The error is sticky: subsequent reads return 0 immediately.

Source

Thrown at pkg/proc/core/minidump/minidump.go:44

	"github.com/go-delve/delve/pkg/proc/winutil"
)

type minidumpBuf struct {
	buf  []byte
	kind string
	off  int
	err  error
	ctx  string
}

func (buf *minidumpBuf) u16() uint16 {
	const stride = 2
	if buf.err != nil {
		return 0
	}
	if buf.off+stride >= len(buf.buf) {
		buf.err = fmt.Errorf("minidump %s truncated at offset %#x while %s", buf.kind, buf.off, buf.ctx)
	}
	r := binary.LittleEndian.Uint16(buf.buf[buf.off : buf.off+stride])
	buf.off += stride
	return r
}

func (buf *minidumpBuf) u32() uint32 {
	const stride = 4
	if buf.err != nil {
		return 0
	}
	if buf.off+stride >= len(buf.buf) {
		buf.err = fmt.Errorf("minidump %s truncated at offset %#x while %s", buf.kind, buf.off, buf.ctx)
	}
	r := binary.LittleEndian.Uint32(buf.buf[buf.off : buf.off+stride])
	buf.off += stride
	return r
}

View on GitHub (pinned to a23773e6c3)

Solutions

  1. Re-capture the minidump (procdump -ma or Task Manager 'Create dump file') and verify its size.
  2. Compare the file size to the Memory64List ranges in the dump header; truncated dumps are visibly short.
  3. Validate the .dmp with a tool like dumpchk or windbg's .dumpdebug before loading in Delve.
  4. Re-transfer the file and verify checksums if it came over the network.

Example fix

// before
cfg := &protest.CoreDumpConfig{ ... }
dlv core app.exe app.dmp // truncated dmp
// after
fi, _ := os.Stat(dmpPath)
if fi.Size() < 32 || fi.Size() < expectedDumpSize {
    return fmt.Errorf("minidump %s appears truncated (%d bytes)", dmpPath, fi.Size())
}
Defensive patterns

Strategy: try-catch

Validate before calling

// Pre-validate the minidump before Delve parses it:
func validateMinidump(path string) error {
    b, err := os.ReadFile(path)
    if err != nil { return err }
    if len(b) < 32 || string(b[:4]) != "MDMP" { return fmt.Errorf("%s: not a minidump", path) }
    // header: Signature(4) Version(4) NumberOfStreams(4) StreamDirectoryRva(4) ...
    nStreams := binary.LittleEndian.Uint32(b[8:12])
    dirRva := binary.LittleEndian.Uint32(b[12:16])
    if uint64(dirRva)+uint64(nStreams)*12 > uint64(len(b)) {
        return fmt.Errorf("minidump %s truncated: directory needs %d bytes, file has %d", path, dirRva+uint64(nStreams)*12, len(b))
    }
    return nil
}

Try / catch

// Wrap the core-open call and surface a user-actionable message:
err := debugger.CreateCore(

Prevention

When it happens

Trigger: Calling any read path that consumes a u16 (e.g. readMinidumpHeader and its string kind/context) on a .dmp file whose remaining bytes at buf.off are fewer than 2 — i.e., a truncated minidump.

Common situations: Minidumps cut off by dump-tool failures, incomplete uploads from Windows crash-reporting pipelines, or files accidentally truncated during transfer from Windows machines to a Linux dev box running Delve.

Related errors


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