go-delve/delve · error · errSwissTableNilGroups

bad swiss map, groups pointer is nil

Error message

bad swiss map, groups pointer is nil

What it means

loadCurrentTable checks the map's groups pointer before iterating. errSwissTableNilGroups is returned when the groups pointer of a swiss map is nil (or could not be read as non-nil), so there are no groups to iterate.

Source

Thrown at pkg/proc/mapiter.go:385

	groups *Variable
}

type swissGroup struct {
	ctrls []byte

	// GOEXPERIMENT=nomapsplitgroup
	slots *Variable

	// GOEXPERIMENT=mapsplitgroup
	keys, elems *Variable
}

var (
	errSwissTableCouldNotLoad  = errors.New("could not load one of the tables")
	errSwissMapBadType         = errors.New("swiss table type does not have some required fields")
	errSwissMapBadTableField   = errors.New("swiss table bad table field")
	errSwissMapBadGroupTypeErr = errors.New("bad swiss map type, group type lacks some required fields")
	errSwissTableNilGroups     = errors.New("bad swiss map, groups pointer is nil")
)

// loadTypes determines the correct type for it.dirPtr:  the linker records
// this type as **table but in reality it is either *[dirLen]*table for
// large maps or *group for small maps, when it.dirLen == 0.
func (it *mapIteratorSwiss) loadTypes() {
	tableptrptrtyp, ok := it.dirPtr.DwarfType.(*godwarf.PtrType)
	if !ok {
		it.v.Unreadable = errSwissMapBadTableField
		return
	}
	tableptrtyp, ok := tableptrptrtyp.Type.(*godwarf.PtrType)
	if !ok {
		it.v.Unreadable = errSwissMapBadTableField
		return
	}
	it.tableType, ok = tableptrtyp.Type.(*godwarf.StructType)
	if !ok {

View on GitHub (pinned to a23773e6c3)

Solutions

  1. Confirm the map variable is the live, initialized one (print its address and header fields)
  2. Re-read the variable after the process has run (an in-progress map assignment can transiently expose nil groups)
  3. If debugging a core dump, verify it was captured from the same binary and is not truncated
Defensive patterns

Strategy: retry

Validate before calling

// Check the map is initialized and live before iterating:
//   print &m   // non-nil address
//   print m    // a count > 0 or nil indicates init state

Try / catch

val, err := printMap(m)
if err != nil && strings.Contains(err.Error(), "groups pointer is nil") {
    contAndWait()           // let any in-progress map assignment finish
    val, err = printMap(m)
}

Prevention

When it happens

Trigger: Iterating a swiss map whose table's groups pointer reads as nil in target memory during loadCurrentTable — e.g. the map structure in memory is zeroed, the pointer read failed, or the loaded map variable is stale.

Common situations: Inspecting a map that was not initialized as expected (zero-valued struct embedding a map); reading a map from a stale or mismatched core dump; races where the map is being modified concurrently in the target.

Related errors


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