{"record":{"id":"a2bb88aea31921f3","repo":"NationalSecurityAgency/ghidra","slug":"memory-addresses-cannot-be-associated-with-a-threa","errorCode":null,"errorMessage":"Memory addresses cannot be associated with a thread","messagePattern":"Memory addresses cannot be associated with a thread","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/symbol/DBTraceSymbolManager.java","lineNumber":364,"sourceCode":"\n\t\t\tfor (AbstractDBTraceSymbolSingleTypeView<?> view : symbolViews.values()) {\n\t\t\t\tview.invalidateCache();\n\t\t\t}\n\n\t\t\tif (globalNamespace.isDeleted()) {\n\t\t\t\tthrow new AssertionError();\n\t\t\t}\n\t\t}\n\t}\n\n\t// Internal\n\tpublic void replaceDataTypes(Map<Long, Long> dataTypeReplacementMap) {\n\t\t// Would apply to functions and variables, but those are not supported.\n\t}\n\n\tprotected void assertValidThreadAddress(TraceThread thread, Address address) {\n\t\tif (thread != null && address.isMemoryAddress()) {\n\t\t\tthrow new IllegalArgumentException(\n\t\t\t\t\"Memory addresses cannot be associated with a thread\");\n\t\t}\n\t}\n\n\t@Override\n\tpublic Trace getTrace() {\n\t\treturn trace;\n\t}\n\n\t@Override\n\tpublic AbstractDBTraceSymbol getSymbolByID(long symbolID) {\n\t\tif (symbolID == GlobalNamespace.GLOBAL_NAMESPACE_ID) {\n\t\t\treturn globalNamespace;\n\t\t}\n\t\tbyte typeID = unpackTypeID(symbolID);\n\t\tAbstractDBTraceSymbolSingleTypeView<?> view = symbolViews.get(typeID);\n\t\tif (view == null) {\n\t\t\treturn null;","sourceCodeStart":346,"sourceCodeEnd":382,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/symbol/DBTraceSymbolManager.java#L346-L382","documentation":"Thrown by DBTraceSymbolManager.assertValidThreadAddress: a non-null thread may only be paired with a non-memory (i.e. register) address. Memory addresses exist in address spaces that are independent of any thread, so associating one with a thread is a logical error. Register addresses are thread-scoped and are the only addresses that may carry a thread.","triggerScenarios":"Creating a symbol (label, variable, etc.) with a thread argument while passing a memory-space Address (address.isMemoryAddress() == true), e.g. a register-space address was expected but a memory address was supplied.","commonSituations":"Confusing register-context symbols with memory labels; passing a register Address that is actually a memory-mapped register; auto-wiring a thread into every symbol creation call regardless of address space.","solutions":["For memory addresses pass thread = null.","Only pass a non-null thread when the address is a register address (address.isRegisterAddress() / address.isMemoryAddress() == false).","Split the call site: memory labels go to the no-thread overload, register symbols to the thread-scoped one."],"exampleFix":"// before\nsymMgr.createLabel(span, memAddr, name, ns, SourceType.USER, thread /* non-null */);\n\n// after\nTraceThread t = memAddr.isMemoryAddress() ? null : thread;\nsymMgr.createLabel(span, memAddr, name, ns, SourceType.USER, t);","handlingStrategy":"validation","validationCode":"TraceThread t = (thread != null && address.isMemoryAddress()) ? null : thread;\nsymMgr.createLabel(span, address, name, ns, source, t);","typeGuard":"static boolean threadAddressValid(TraceThread thread, Address address) {\n    return thread == null || !address.isMemoryAddress();\n}","tryCatchPattern":null,"preventionTips":["Pair a thread only with register (non-memory) addresses; pass null thread for memory addresses.","Decide thread-scoping by address space at the call site, not unconditionally."],"tags":["ghidra","trace-modeling","symbol","thread","address-space","illegal-argument"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}