{"record":{"id":"04ddf14a13a157ed","repo":"go-delve/delve","slug":"can-not-access-unreadable-map-v","errorCode":null,"errorMessage":"can not access unreadable map: %v","messagePattern":"can not access unreadable map: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/proc/eval.go","lineNumber":2888,"sourceCode":"\t\t\treturn r, nil\n\t\t} else {\n\t\t\tif idx >= len(v.Children) {\n\t\t\t\treturn nil, errors.New(\"index out of bounds\")\n\t\t\t}\n\t\t\treturn &v.Children[idx], nil\n\t\t}\n\t}\n\tmem := v.mem\n\tif v.Kind != reflect.Array {\n\t\tmem = DereferenceMemory(mem)\n\t}\n\treturn v.newVariable(\"\", v.Base+uint64(int64(idx)*v.stride), v.fieldType, mem), nil\n}\n\nfunc (v *Variable) mapAccess(idx *Variable) (*Variable, error) {\n\tit := v.mapIterator(0)\n\tif it == nil {\n\t\treturn nil, fmt.Errorf(\"can not access unreadable map: %v\", v.Unreadable)\n\t}\n\n\tlcfg := LoadFullValue()\n\tif idx.Kind == reflect.String && int64(len(constant.StringVal(idx.Value))) == idx.Len && idx.Len > int64(lcfg.MaxStringLen) {\n\t\t// If the index is a string load as much of the keys to at least match the length of the index.\n\t\t//TODO(aarzilli): when struct literals are implemented this needs to be\n\t\t//done recursively for literal struct fields.\n\t\tlcfg.MaxStringLen = int(idx.Len)\n\t}\n\n\tfirst := true\n\tfor it.next() {\n\t\tkey := it.key()\n\t\tkey.loadValue(lcfg)\n\t\tif key.Unreadable != nil {\n\t\t\treturn nil, fmt.Errorf(\"can not access unreadable map: %v\", key.Unreadable)\n\t\t}\n\t\tif first {","sourceCodeStart":2870,"sourceCodeEnd":2906,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/pkg/proc/eval.go#L2870-L2906","documentation":"Variable.mapAccess() needs a working map iterator to look up a key. mapIterator returns nil when the map's internal structures cannot be read (v.Unreadable is set — e.g. the memory holding the map header/hmap could not be read). Delve then returns 'can not access unreadable map: <reason>'.","triggerScenarios":"Evaluating m[key] or len(m) style access in the debugger when the map variable's memory is unreadable: map variable itself unreadable, nil map header read failure, corrupt/stale memory, or the process memory at the map's address is invalid.","commonSituations":"Inspecting a map in a crashed or core-dump state where pages are not mapped; stale variable addresses after the program moved on; debugging stripped/minidump cores missing map pages; nil maps being indexed in expressions on cores.","solutions":["Re-run the expression after the program reaches a stable stopped state so map memory is readable","Check the underlying cause printed after the colon (unreadable address) and verify the map variable is valid/non-nil","Load fewer/shorter values (reduce MaxStringLen/MaxArrayValues in the load config) if the failure came from aggressive loading","If in a core dump, confirm the core contains the relevant memory mappings; use a full core or live process","Re-attach or restart the debug session if addresses are stale"],"exampleFix":"// before (dead process memory, map unreadable)\nprint(m[\"key\"])\n// after\nprint(&m[\"key\"])  // or re-check m first: print(m) to see if map header is readable","handlingStrategy":"fallback","validationCode":"// check the map is readable before indexing:\nprint(m)          // if this also fails, memory is unreadable\n// then: print(m[\"key\"])","typeGuard":null,"tryCatchPattern":"// on failure, fall back to printing the whole map or re-inspect later\n// if err like 'can not access unreadable map' -> print(m) or step to stable state and retry","preventionTips":["Inspect maps at stable breakpoints, not during teardown","Use full core dumps when debugging cores","Check the unreadable address against memory mappings"],"tags":["go","debugger","map","memory"],"backgroundTag":"unreadable-memory","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}