{"record":{"id":"34e8c1ad2efb89d8","repo":"go-delve/delve","slug":"could-not-load-one-of-the-tables","errorCode":null,"errorMessage":"could not load one of the tables","messagePattern":"could not load one of the tables","errorType":"error_code","errorClass":"errSwissTableCouldNotLoad","httpStatus":null,"severity":"error","filePath":"pkg/proc/mapiter.go","lineNumber":381,"sourceCode":"}\n\ntype swissTable struct {\n\tindex  int64\n\tgroups *Variable\n}\n\ntype swissGroup struct {\n\tctrls []byte\n\n\t// GOEXPERIMENT=nomapsplitgroup\n\tslots *Variable\n\n\t// GOEXPERIMENT=mapsplitgroup\n\tkeys, elems *Variable\n}\n\nvar (\n\terrSwissTableCouldNotLoad  = errors.New(\"could not load one of the tables\")\n\terrSwissMapBadType         = errors.New(\"swiss table type does not have some required fields\")\n\terrSwissMapBadTableField   = errors.New(\"swiss table bad table field\")\n\terrSwissMapBadGroupTypeErr = errors.New(\"bad swiss map type, group type lacks some required fields\")\n\terrSwissTableNilGroups     = errors.New(\"bad swiss map, groups pointer is nil\")\n)\n\n// loadTypes determines the correct type for it.dirPtr:  the linker records\n// this type as **table but in reality it is either *[dirLen]*table for\n// large maps or *group for small maps, when it.dirLen == 0.\nfunc (it *mapIteratorSwiss) loadTypes() {\n\ttableptrptrtyp, ok := it.dirPtr.DwarfType.(*godwarf.PtrType)\n\tif !ok {\n\t\tit.v.Unreadable = errSwissMapBadTableField\n\t\treturn\n\t}\n\ttableptrtyp, ok := tableptrptrtyp.Type.(*godwarf.PtrType)\n\tif !ok {\n\t\tit.v.Unreadable = errSwissMapBadTableField","sourceCodeStart":363,"sourceCodeEnd":399,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/pkg/proc/mapiter.go#L363-L399","documentation":"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.","triggerScenarios":"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.","commonSituations":"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).","solutions":["Upgrade Delve to a release that supports the target's exact Go version/swiss map layout","Verify the map pointer is valid and the memory region is readable (retry after the process runs again)","Re-capture core dumps with all memory segments included"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// Before iterating, ensure the process is stopped at a consistent point and the map header is readable:\n//   head, err := readVariable(expr + \".count\")\n//   if err != nil { /* map not readable now; step/resume and retry */ }","typeGuard":null,"tryCatchPattern":"// Wrap map evaluation and retry once after the target runs:\nres, err := printMap(m)\nif err != nil {\n    contAndWait()\n    res, err = printMap(m) // transient unreadable memory often resolves\n}","preventionTips":["Evaluate maps only while the target is reliably stopped","Use complete core dumps captured from the matching binary","Upgrade Delve for the target Go version before deep map inspection"],"tags":["go","maps","swiss-table","memory"],"backgroundTag":"swiss-map-iteration-failure","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}