{"record":{"id":"235139a05177e2ae","repo":"go-delve/delve","slug":"error-accessing-swiss-map-slot-v-v","errorCode":null,"errorMessage":"error accessing swiss map slot: %v %v","messagePattern":"error accessing swiss map slot: (.+?) (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"pkg/proc/mapiter.go","lineNumber":559,"sourceCode":"\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tvar err1, err2 error\n\t\t\t\tif it.mapsplitgroup {\n\t\t\t\t\tit.curKey, err1 = it.group.keys.sliceAccess(int(it.slotIdx))\n\t\t\t\t\tit.curValue, err2 = it.group.elems.sliceAccess(int(it.slotIdx))\n\t\t\t\t} else {\n\t\t\t\t\tcur, err := it.group.slots.sliceAccess(int(it.slotIdx))\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tit.v.Unreadable = fmt.Errorf(\"error accessing swiss map in table %d, group %d, slot %d\", it.dirIdx, it.groupIdx, it.slotIdx)\n\t\t\t\t\t\treturn false\n\t\t\t\t\t}\n\n\t\t\t\t\tit.curKey, err1 = cur.toField(it.slotFieldKey)\n\t\t\t\t\tit.curValue, err2 = cur.toField(it.slotFieldElem)\n\t\t\t\t}\n\t\t\t\tif err1 != nil || err2 != nil {\n\t\t\t\t\tit.v.Unreadable = fmt.Errorf(\"error accessing swiss map slot: %v %v\", err1, err2)\n\t\t\t\t\treturn false\n\t\t\t\t}\n\n\t\t\t\t// If the type we expect is non-pointer but we read a pointer type it\n\t\t\t\t// means that the key (or the value) is stored indirectly into the map\n\t\t\t\t// because it is too big. We dereference it here so that the type of the\n\t\t\t\t// key (or value) matches the type on the map definition.\n\t\t\t\tif it.curKey.Kind == reflect.Ptr && !it.keyTypeIsPtr {\n\t\t\t\t\tit.curKey = it.curKey.maybeDereference()\n\t\t\t\t}\n\t\t\t\tif it.curValue.Kind == reflect.Ptr && !it.elemTypeIsPtr {\n\t\t\t\t\tit.curValue = it.curValue.maybeDereference()\n\t\t\t\t}\n\n\t\t\t\tit.slotIdx++\n\t\t\t\treturn true\n\t\t\t}\n","sourceCodeStart":541,"sourceCodeEnd":577,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/pkg/proc/mapiter.go#L541-L577","documentation":"After successfully reading a swiss map slot, the iterator converts it into the key and element fields. If either conversion (reading the key or value out of the slot) fails due to unreadable memory, the Variable is marked Unreadable with both underlying errors.","triggerScenarios":"Evaluating a swiss map where the slot's key or value region is unreadable — bad tophash-to-slot offsets, corrupted group data, stale iterators after map mutation, or incomplete core dump memory.","commonSituations":"Inspecting large maps in truncated core files; version mismatch between delve and the Go runtime's swiss map layout; inspecting a map concurrently being modified when the process resumes.","solutions":["Upgrade delve to match the target Go version's swiss map internals","Re-read the map variable at the current stop instead of a cached one","Check process/core memory integrity and re-acquire the map after program stops"],"exampleFix":"// before\nsavedVar := mapVar // captured earlier\nprintMap(savedVar) // stale after map grew\n// after\nfresh, err := debugger.FindVariable(\"mapVar\")\nif err != nil { return err }\nprintMap(fresh)","handlingStrategy":"fallback","validationCode":"if v.Unreadable != nil {\n    return fmt.Errorf(\"map not readable: %v\", v.Unreadable)\n}","typeGuard":"func isReadable(v *proc.Variable) bool {\n    return v.Unreadable == nil\n}","tryCatchPattern":"ok := iterateMap(it)\nif !ok && it.v.Unreadable != nil {\n    if strings.Contains(it.v.Unreadable.Error(), \"error accessing swiss map slot\") {\n        return reEvaluateAndIterate(mapExpr)\n    }\n    return it.v.Unreadable\n}","preventionTips":["Re-fetch map variables at the current stop point","Upgrade delve when the Go runtime map layout changes","Inspect maps only while the target is stopped and memory is stable"],"tags":["go","maps","swissmap","variables"],"backgroundTag":"variable-unreadable-memory","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}