{"record":{"id":"14f5524f72df49cd","repo":"NationalSecurityAgency/ghidra","slug":"the-specified-source-address-range-never-had-an-ex","errorCode":null,"errorMessage":"The specified source address range never had an external address pair added to the translator.","messagePattern":"The specified source address range 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":116,"sourceCode":"\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}\n\t\tthrow new AddressTranslationException(\n\t\t\t\"The specified source address range never had an external address pair added to the translator.\");\n\t}\n\n}\n","sourceCodeStart":98,"sourceCodeEnd":121,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Features/Base/src/main/java/ghidra/app/merge/listing/ExternalsAddressTranslator.java#L98-L121","documentation":"Thrown as AddressTranslationException by ExternalsAddressTranslator.getAddressRange for a single-length range whose source address is not present in addressMap. This is the range-API equivalent of the getAddress miss: the source address was never registered via setPair.","triggerScenarios":"Calling getAddressRange on a single-length AddressRange whose min address has no registered destination — i.e. setPair was not called for that source address, or it was removed by a prior setPair(null, source).","commonSituations":"Translating external location ranges where only a subset of locations were pre-registered; a setPair(null, source) call inadvertently cleared a mapping.","solutions":["Register the pair via setPair(destination, source) before calling getAddressRange.","Guard with addressMap.containsKey / use getAddress first to probe, then build the range.","Catch AddressTranslationException and fall back to a compatibility-mapping utility."],"exampleFix":"// before\nAddressRange r = translator.getAddressRange(new AddressRangeImpl(src, src)); // throws\n\n// after — register the pair first\ntranslator.setPair(dest, src);\nAddressRange r = translator.getAddressRange(new AddressRangeImpl(src, src));","handlingStrategy":"validation","validationCode":"Address src = sourceAddressRange.getMinAddress();\ntranslator.setPair(map(src), src); // ensure registration before range lookup","typeGuard":"// ensure the source address of the single-length range was registered\nboolean registered = /* wrapper exposes addressMap.containsKey(src) */;","tryCatchPattern":"try {\n    return translator.getAddressRange(sourceAddressRange);\n} catch (AddressTranslationException e) {\n    return null; // no mapping for this external range\n}","preventionTips":["Register all external source addresses via setPair before any range translation.","Probe with getAddress first, then wrap the result in AddressRangeImpl."],"tags":["ghidra","merge","address-translator","external"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}