go-delve/delve · error
can not access unreadable map: %v
Error message
can not access unreadable map: %v
What it means
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>'.
Source
Thrown at pkg/proc/eval.go:2888
return r, nil
} else {
if idx >= len(v.Children) {
return nil, errors.New("index out of bounds")
}
return &v.Children[idx], nil
}
}
mem := v.mem
if v.Kind != reflect.Array {
mem = DereferenceMemory(mem)
}
return v.newVariable("", v.Base+uint64(int64(idx)*v.stride), v.fieldType, mem), nil
}
func (v *Variable) mapAccess(idx *Variable) (*Variable, error) {
it := v.mapIterator(0)
if it == nil {
return nil, fmt.Errorf("can not access unreadable map: %v", v.Unreadable)
}
lcfg := LoadFullValue()
if idx.Kind == reflect.String && int64(len(constant.StringVal(idx.Value))) == idx.Len && idx.Len > int64(lcfg.MaxStringLen) {
// If the index is a string load as much of the keys to at least match the length of the index.
//TODO(aarzilli): when struct literals are implemented this needs to be
//done recursively for literal struct fields.
lcfg.MaxStringLen = int(idx.Len)
}
first := true
for it.next() {
key := it.key()
key.loadValue(lcfg)
if key.Unreadable != nil {
return nil, fmt.Errorf("can not access unreadable map: %v", key.Unreadable)
}
if first {View on GitHub (pinned to a23773e6c3)
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
Example fix
// before (dead process memory, map unreadable) print(m["key"]) // after print(&m["key"]) // or re-check m first: print(m) to see if map header is readable
Defensive patterns
Strategy: fallback
Validate before calling
// check the map is readable before indexing: print(m) // if this also fails, memory is unreadable // then: print(m["key"])
Try / catch
// on failure, fall back to printing the whole map or re-inspect later // if err like 'can not access unreadable map' -> print(m) or step to stable state and retry
Prevention
- Inspect maps at stable breakpoints, not during teardown
- Use full core dumps when debugging cores
- Check the unreadable address against memory mappings
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- second slice argument must be empty for maps
- map index out of bounds
- write out of bounds
- map index out of bounds
- could not load swiss table groups data: %v
AI-assisted analysis of go-delve/delve@a23773e6c3 (2026-08-31).
Data as JSON: /api/errors/04ddf14a13a157ed.
Report an issue: GitHub.