{"record":{"id":"3192ab6ebaba8cd1","repo":"NationalSecurityAgency/ghidra","slug":"guest-address-addr-is-not-mapped-or-the-mapped","errorCode":null,"errorMessage":"Guest address ${addr} is not mapped, or the mapped address does not exist in host memory","messagePattern":"Guest address (.+?) is not mapped, or the mapped address does not exist in host memory","errorType":"exception","errorClass":"MemoryAccessException","httpStatus":null,"severity":"error","filePath":"Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/guest/DBTraceGuestPlatformMappedMemory.java","lineNumber":392,"sourceCode":"\t\treturn buffer.position() - startPos;\n\t}\n\n\tprotected ByteBuffer getBytesInFull(Address address, int len) throws MemoryAccessException {\n\t\tByteBuffer buf = ByteBuffer.allocate(len);\n\t\tif (getBytes(buf, address) != len) {\n\t\t\tthrow new MemoryAccessException(\"Could not read enough bytes\");\n\t\t}\n\t\tif (!isBigEndian()) {\n\t\t\tbuf.order(ByteOrder.LITTLE_ENDIAN);\n\t\t}\n\t\treturn buf;\n\t}\n\n\t@Override\n\tpublic byte getByte(Address addr) throws MemoryAccessException {\n\t\tbyte[] val = new byte[1];\n\t\tif (getBytes(addr, val) < 1) {\n\t\t\tthrow new MemoryAccessException(\"Guest address \" + addr.toString() +\n\t\t\t\t\" is not mapped, or the mapped address does not exist in host memory\");\n\t\t}\n\t\treturn val[0];\n\t}\n\n\t@Override\n\tpublic int getBytes(Address addr, byte[] dest) throws MemoryAccessException {\n\t\treturn getBytes(addr, dest, 0, dest.length);\n\t}\n\n\t@Override\n\tpublic int getBytes(Address addr, byte[] dest, int destIndex, int size)\n\t\t\tthrows MemoryAccessException {\n\t\treturn getBytes(ByteBuffer.wrap(dest, destIndex, size), addr);\n\t}\n\n\t@Override\n\tpublic short getShort(Address addr) throws MemoryAccessException {","sourceCodeStart":374,"sourceCodeEnd":410,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/guest/DBTraceGuestPlatformMappedMemory.java#L374-L410","documentation":"getByte reads one byte via getBytes(addr, val); if zero bytes were returned it throws MemoryAccessException naming the guest address: \"Guest address X is not mapped, or the mapped address does not exist in host memory\". Either no guest-to-host mapping covers the address, or a mapping exists but the host side has no backing memory for the snapshot.","triggerScenarios":"Reading a guest address outside any addMappedRange; reading inside a mapping whose host address has no written memory for the current snapshot.","commonSituations":"Emulation touching unmapped guest memory; querying before host memory has been populated for the snapshot; stale mappings after host memory was cleared.","solutions":["Confirm a mapping exists for the address and that host memory is populated for the snapshot before reading.","Add the missing mapping and/or write host bytes for the snapshot.","Catch MemoryAccessException and treat the address as unmapped."],"exampleFix":"// before\nbyte b = guestMem.getByte(addr);\n\n// after\ntry {\n    byte b = guestMem.getByte(addr);\n} catch (MemoryAccessException e) {\n    // unmapped or unmapped host backing: handle gracefully\n}","handlingStrategy":"try-catch","validationCode":"// confirm a mapping covers the address and host memory is populated\nif (platform.mapGuestToHost(addr) == null) { /* unmapped; skip */ }","typeGuard":null,"tryCatchPattern":"try { byte b = guestMem.getByte(addr); }\ncatch (MemoryAccessException e) { /* unmapped guest or missing host backing */ }","preventionTips":["Establish and verify guest-to-host mappings before emulation reads.","Populate host memory for the active snapshot before reading guest addresses.","Catch MemoryAccessException at emulation boundaries to model unmapped access."],"tags":["memory","mapping","guest","read"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}