go-delve/delve · error

location starting at %#x of size %#x is past the end of file

Error message

location starting at %#x of size %#x is past the end of file, while %s

What it means

While parsing a minidump's data structures, a location (file offset + size) read from the dump points at or beyond the actual file length. The dumpBuffer guards every bounded read and records this error in buf.err, aborting parsing. It means the file's internal offsets are inconsistent with its size, i.e. the dump is truncated or corrupt.

Source

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

		stream.Offset, stream.RawData = readLocationDescriptor(buf)
		if buf.err != nil {
			return
		}
	}
}

// readLocationDescriptor reads a location descriptor structure (a structure
// which describes a subregion of the file), and returns the destination
// offset and a slice into the minidump file's buffer.
func readLocationDescriptor(buf *minidumpBuf) (off int, rawData []byte) {
	sz := buf.u32()
	off = int(buf.u32())
	if buf.err != nil {
		return off, nil
	}
	end := off + int(sz)
	if off >= len(buf.buf) || end > len(buf.buf) {
		buf.err = fmt.Errorf("location starting at %#x of size %#x is past the end of file, while %s", off, sz, buf.ctx)
		return 0, nil
	}
	rawData = buf.buf[off:end]
	return
}

func readString(buf *minidumpBuf) string {
	startOff := buf.off
	sz := buf.u32()
	if buf.err != nil {
		return ""
	}
	end := buf.off + int(sz)
	if buf.off >= len(buf.buf) || end > len(buf.buf) {
		buf.err = fmt.Errorf("string starting at %#x of size %#x is past the end of file, while %s", startOff, sz, buf.ctx)
		return ""
	}
	return decodeUTF16(buf.buf[buf.off:end])

View on GitHub (pinned to a23773e6c3)

Solutions

  1. Re-capture the minidump; ensure the transfer completed (compare byte sizes / checksums between producer and consumer).
  2. Open the dump in WinDbg or dumpchk to confirm which stream is damaged.
  3. If truncated mid-transfer, re-download or restore the original copy.
  4. If producing dumps programmatically (MiniDumpWriteDump), ensure the write completes and the handle is flushed/closed before shipping.

Example fix

// before: loading a truncated dump
core, err := proc.LoadMiniDumpFile("truncated.dmp", nil, 0)

// after: verify the file is complete first
fi, _ := os.Stat("full.dmp")
if fi.Size() < expectedMinSize { log.Fatal("dump truncated") }
core, err := proc.LoadMiniDumpFile("full.dmp", nil, 0)
Defensive patterns

Strategy: validation

Validate before calling

func dumpLooksIntact(path string, minExpected int64) error {
    fi, err := os.Stat(path)
    if err != nil { return err }
    if fi.Size() < minExpected {
        return fmt.Errorf("dump %s is %d bytes, expected at least %d - likely truncated", path, fi.Size(), minExpected)
    }
    return nil
}

Try / catch

core, err := proc.LoadMiniDumpFile(dumpPath, logfn, 0)
if err != nil {
    if strings.Contains(err.Error(), "past the end of file") {
        return fmt.Errorf("minidump %s is truncated or corrupt; re-capture it (cause: %w)", dumpPath, err)
    }
    return err
}

Prevention

When it happens

Trigger: Calling proc.LoadMiniDumpFile on a minidump where a descriptor's offset (read via buf.u32()) plus its size exceeds len(buf.buf); typically hit while parsing memory streams, module data, or thread context locations.

Common situations: A minidump truncated by an incomplete file copy/upload, a dump written while the process was still crashing, cloud storage that cut the file off, or a hand-edited/corrupted dump.

Related errors


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