go-delve/delve · error

Unhandled case: existing entry is %v len %v, new is %v len %

Error message

Unhandled case: existing entry is %v len %v, new is %v len %v

What it means

Delve's core-dump backend maintains an ordered list of memory reader regions (spliced from core notes, loaded files, ELF segments). The 'add' helper in SplicedReader inserts a new reader region into the list, handling overlapping cases (replacing, prepending, appending, or punching a hole in an existing entry). When the new region overlaps an existing one in a way none of the switch cases cover, the default branch panics with the offsets and lengths of both entries, signaling a bug in the splice logic rather than bad user input.

Source

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

			add(entry)
		case off <= entry.offset && end < entryEnd:
			// New reader overwrites the beginning of the entry.
			if !inserted {
				add(readerEntry{off, length, reader})
				inserted = true
			}
			overlap := entry.offset - off
			entry.offset += overlap
			entry.length -= overlap
			add(entry)
		case entry.offset < off && end < entryEnd:
			// New region punches a hole in the entry. Split it in two and put the new region in the middle.
			add(readerEntry{entry.offset, off - entry.offset, entry.reader})
			add(readerEntry{off, length, reader})
			add(readerEntry{end + 1, entryEnd - end, entry.reader})
			inserted = true
		default:
			panic(fmt.Sprintf("Unhandled case: existing entry is %v len %v, new is %v len %v", entry.offset, entry.length, off, length))
		}
	}
	if !inserted {
		newReaders = append(newReaders, readerEntry{off, length, reader})
	}
	r.readers = newReaders
}

// ReadMemory implements MemoryReader.ReadMemory.
func (r *SplicedMemory) ReadMemory(buf []byte, addr uint64) (n int, err error) {
	started := false
	for _, entry := range r.readers {
		if entry.offset+entry.length <= addr {
			if !started {
				continue
			}
			return n, fmt.Errorf("hit unmapped area at %v after %v bytes", addr, n)
		}

View on GitHub (pinned to a23773e6c3)

Solutions

  1. Inspect the panic message offsets/lengths and add a case (or generalize an existing case) in the splice switch to correctly handle that overlap combination
  2. Dump the core file's memory notes and ELF segments (readelf -n / readelf -l) and check for partially overlapping regions that violate assumptions
  3. Minimize with a failing test fixture core file reproducing the overlap, then fix the merge logic
  4. Report upstream to go-delve/delve with the core file (or a sanitized reproduction) since this indicates an unhandled internal case

Example fix

// before
default:
    panic(fmt.Sprintf("Unhandled case: existing entry is %v len %v, new is %v len %v", entry.offset, entry.length, off, length))
// after
default:
    // Overlap not handled: fail gracefully instead of crashing.
    return fmt.Errorf("splicedReader: unhandled overlap %v+%v vs %v+%v", entry.offset, entry.length, off, length)
Defensive patterns

Strategy: validation

Validate before calling

// Validate overlap shape before calling the splice logic:
func overlapHandled(entryOff, entryLen, off, length uint64) bool {
	end, entryEnd := off+length-1, entryOff+entryLen-1
	switch {
	case off == entryOff && end == entryEnd: // full replace
		return true
	case off > entryOff && end < entryEnd: // contained
		return true
	case off <= entryOff && end >= entryEnd: // superset
		return true
	case off == entryEnd+1 || end == entryOff-1: // adjacent
		return true
	}
	return false
}

Prevention

When it happens

Trigger: Adding a reader region to a spliced reader whose start/end partially straddles an existing entry in a combination not handled by the switch's named cases (equal-range replace, contained, superset, left-truncate, right-truncate, hole-split). Typically hit when a core file contains memory notes that overlap a mapped ELF segment in an unusual partial way, or when loaded extra-file regions overlap core memory.

Common situations: Opening a core/minidump file whose PT_NOTE memory regions overlap its PT_LOAD segments only partially; debugging a core from an unusual producer (older kernels, non-Go core generators, CRIU dumps); regression after changes to pkg/proc/core region merging.

Related errors


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