go-delve/delve · error

could not load swiss map group slots: %v

Error message

could not load swiss map group slots: %v

What it means

Set on a map Variable by loadCurrentGroup when, in the combined-slot representation (non split-group), the 'slots' array field of the group cannot be resolved from DWARF. Delve throws it because keys and values live inside slot structs in this layout, and iteration cannot proceed without the slots field.

Source

Thrown at pkg/proc/mapiter.go:694

		it.v.Unreadable = err
		return
	}

	if it.mapsplitgroup {
		g.keys, err2 = group.toField(it.groupFieldKeys)
		if err2 != nil {
			it.v.Unreadable = fmt.Errorf("could not load swiss map group keys: %v", err2)
			return
		}
		g.elems, err2 = group.toField(it.groupFieldElems)
		if err2 != nil {
			it.v.Unreadable = fmt.Errorf("could not load swiss map group elems: %v", err2)
			return
		}
	} else {
		g.slots, err2 = group.toField(it.groupFieldSlots)
		if err2 != nil {
			it.v.Unreadable = fmt.Errorf("could not load swiss map group slots: %v", err2)
			return
		}
	}

	it.group = g
}

func (it *mapIteratorSwiss) key() *Variable {
	return it.curKey
}

func (it *mapIteratorSwiss) value() *Variable {
	return it.curValue
}

func (it *mapIteratorSwiss) slotIsEmptyOrDeleted(k uint32) bool {
	// TODO: check that this hasn't changed after it's merged and the TODO is deleted
	return it.group.ctrls[k]&swissTableCtrlEmpty == swissTableCtrlEmpty

View on GitHub (pinned to a23773e6c3)

Solutions

  1. Upgrade Delve to match the target's Go version
  2. Rebuild the target binary with complete DWARF and no post-link stripping/obfuscation
  3. Confirm Go version compatibility in Delve's supported-versions documentation
  4. Temporarily expose map data through a slice for debugging

Example fix

// before
go build -trimpath -ldflags="-s -w" -o app .
// after
go build -gcflags="-N -l" -o app .
Defensive patterns

Strategy: type-guard

Validate before calling

if v.Unreadable != nil { return } // slots field unresolvable; swiss map layout mismatch

Type guard

func inspectableMap(v *proc.Variable) bool { return v != nil && v.Unreadable == nil && v.Kind == reflect.Map }

Try / catch

if v.Unreadable != nil { return nil, fmt.Errorf("map unreadable: %w", v.Unreadable) }

Prevention

When it happens

Trigger: Iterating a swiss map where groups store combined key/elem slots and group.toField(it.groupFieldSlots) fails because the group type in the debug info has no 'slots' field or it can't be read.

Common situations: Go runtime layout changed across releases; Delve version older than the target's Go version; DWARF damaged by -w -s, strip, or obfuscation tools (e.g. garble).

Related errors


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