go-delve/delve · error · errSwissTableCouldNotLoad

could not load one of the tables

Error message

could not load one of the tables

What it means

For Go 1.24+ swiss-table maps, loadCurrentTable loads the 'dir' and its table(s). errSwissTableCouldNotLoad is returned when one of the required tables (directory, groups, or the key/elem arrays) could not be loaded from the target process, so iteration cannot proceed.

Source

Thrown at pkg/proc/mapiter.go:381

}

type swissTable struct {
	index  int64
	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

View on GitHub (pinned to a23773e6c3)

Solutions

  1. Upgrade Delve to a release that supports the target's exact Go version/swiss map layout
  2. Verify the map pointer is valid and the memory region is readable (retry after the process runs again)
  3. Re-capture core dumps with all memory segments included
Defensive patterns

Strategy: retry

Validate before calling

// Before iterating, ensure the process is stopped at a consistent point and the map header is readable:
//   head, err := readVariable(expr + ".count")
//   if err != nil { /* map not readable now; step/resume and retry */ }

Try / catch

// Wrap map evaluation and retry once after the target runs:
res, err := printMap(m)
if err != nil {
    contAndWait()
    res, err = printMap(m) // transient unreadable memory often resolves
}

Prevention

When it happens

Trigger: Iterating a swiss map when loadCurrentTable fails to load any of the required sub-structures — typically a failed memory read of the directory pointer or tables (nil/invalid pointer, unreadable memory) at the moment 'print m' or a range over the map is evaluated.

Common situations: Debugging a Go 1.24+ binary where a map variable lives in unreadable or swapped-out memory; stale core dump segments; Delve version that predates the exact swiss map layout of the target's Go release (e.g. GOEXPERIMENT variants like mapsplitgroup).

Related errors


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