{"record":{"id":"650fc00c29046cff","repo":"NationalSecurityAgency/ghidra","slug":"the-specified-source-address-set-never-had-an-exte","errorCode":null,"errorMessage":"The specified source address set never had an external address pair added to the translator.","messagePattern":"The specified source address set never had an external address pair added to the translator\\.","errorType":"exception","errorClass":"AddressTranslationException","httpStatus":null,"severity":"error","filePath":"Ghidra/Features/Base/src/main/java/ghidra/app/merge/listing/ExternalsAddressTranslator.java","lineNumber":97,"sourceCode":"\t@Override\n\tpublic AddressSet getAddressSet(AddressSetView sourceAddressSet) {\n\t\tif (sourceAddressSet == null) {\n\t\t\treturn null;\n\t\t}\n\t\tif (sourceAddressSet.getNumAddresses() > 1) {\n\t\t\tthrow new AddressTranslationException(\n\t\t\t\t\"An external address translator can only handle a single address at a time, if that.\");\n\t\t}\n\t\tAddressSet destinationSet = new AddressSet();\n\t\tif (sourceAddressSet.isEmpty()) {\n\t\t\treturn destinationSet;\n\t\t}\n\t\tAddress sourceAddress = sourceAddressSet.getMinAddress();\n\t\tAddress destinationAddress = addressMap.get(sourceAddress);\n\t\tif (destinationAddress != null) {\n\t\t\tdestinationSet.add(destinationAddress);\n\t\t}\n\t\tthrow new AddressTranslationException(\n\t\t\t\"The specified source address set never had an external address pair added to the translator.\");\n\t}\n\n\t@Override\n\tpublic AddressRange getAddressRange(AddressRange sourceAddressRange)\n\t\t\tthrows AddressTranslationException {\n\t\tif (sourceAddressRange == null) {\n\t\t\treturn null;\n\t\t}\n\t\tif (sourceAddressRange.getLength() != 1) {\n\t\t\tthrow new AddressTranslationException(\n\t\t\t\t\"An external address translator can only handle a single address at a time, if that.\");\n\t\t}\n\t\tAddress sourceAddress = sourceAddressRange.getMinAddress();\n\t\tAddress destinationAddress = addressMap.get(sourceAddress);\n\t\tif (destinationAddress != null) {\n\t\t\treturn new AddressRangeImpl(destinationAddress, destinationAddress);\n\t\t}","sourceCodeStart":79,"sourceCodeEnd":115,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Features/Base/src/main/java/ghidra/app/merge/listing/ExternalsAddressTranslator.java#L79-L115","documentation":"Thrown as AddressTranslationException at the end of getAddressSet after the single-address path. NOTE: this throw is unconditional — it executes even when a destination was found and added to destinationSet, because the throw is not inside an else branch. As written, getAddressSet effectively always fails for a non-empty single-address set. The message claims the pair was never added, but that is only accurate when addressMap.get returned null.","triggerScenarios":"Calling getAddressSet with a single-address AddressSetView — the throw fires regardless of whether the source address was registered via setPair. The only way getAddressSet returns normally is an empty set (returns early) or a null input (returns null).","commonSituations":"Any caller relying on getAddressSet for a populated single-address external set; this is a latent bug in the translator that surfaces whenever external set translation is attempted rather than single-address getAddress/getAddressRange.","solutions":["Avoid getAddressSet for single external addresses; use getAddress(source) instead, which correctly returns on a hit.","Patch ExternalsAddressTranslator.getAddressSet so the throw is inside an else block (return destinationSet when destinationAddress != null).","If you cannot patch, wrap the call in try/catch(AddressTranslationException) and recover the single destination via getAddress on getMinAddress."],"exampleFix":"// before (buggy — throws even when found)\nAddress destinationAddress = addressMap.get(sourceAddress);\nif (destinationAddress != null) {\n    destinationSet.add(destinationAddress);\n}\nthrow new AddressTranslationException(\n    \"The specified source address set never had an external address pair added to the translator.\");\n\n// after — return on hit, throw only on miss\nAddress destinationAddress = addressMap.get(sourceAddress);\nif (destinationAddress != null) {\n    destinationSet.add(destinationAddress);\n    return destinationSet;\n}\nthrow new AddressTranslationException(\n    \"The specified source address set never had an external address pair added to the translator.\");","handlingStrategy":"fallback","validationCode":"// getAddressSet is buggy (unconditional throw) — avoid it for single external addresses.\n// Use getAddress directly on the min address.\nAddress src = sourceAddressSet.getMinAddress();\nif (src != null) {\n    translator.setPair(map(src), src);\n    AddressSet out = new AddressSet();\n    out.add(translator.getAddress(src));\n    return out;\n}","typeGuard":"// no safe input exists for a populated single-address set under current code;\n// treat the method as unusable and route around it.","tryCatchPattern":"try {\n    return translator.getAddressSet(set);\n} catch (AddressTranslationException e) {\n    // recover via getAddress on the single min address\n    Address d = translator.getAddress(set.getMinAddress());\n    return new AddressSet(d, d);\n}","preventionTips":["Do not call getAddressSet on ExternalsAddressTranslator with populated sets — it always throws.","Use getAddress(min) as the reliable single-address path.","Patch the unconditional throw into an else branch if you own the class."],"tags":["ghidra","merge","address-translator","bug","external"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}