{"record":{"id":"f7634ac7c7d66ccd","repo":"NationalSecurityAgency/ghidra","slug":"name-f7634a","errorCode":null,"errorMessage":"{name}","messagePattern":"\\{name\\}","errorType":"validation","errorClass":"DuplicateNameException","httpStatus":null,"severity":"warning","filePath":"Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/property/DBTraceAddressPropertyManager.java","lineNumber":175,"sourceCode":"\t\t\t\t\ttableName, dbh, openMode, lock, TaskMonitor.DUMMY, baseLanguage, trace,\n\t\t\t\t\tthreadManager, saveableClass);\n\t\t\t}\n\t\t}\n\t\tcatch (IOException e) {\n\t\t\tdbError(e);\n\t\t}\n\t\tcatch (VersionException e) {\n\t\t\tthrow new AssertionError(e);\n\t\t}\n\t\tthrow new IllegalArgumentException(\"Unsupported value class: \" + valueClass);\n\t}\n\n\t@Override\n\tpublic <T> AbstractDBTracePropertyMap<T, ?> createPropertyMap(String name, Class<T> valueClass)\n\t\t\tthrows DuplicateNameException {\n\t\ttry (LockHold hold = LockHold.lock(lock.writeLock())) {\n\t\t\tif (propertyMapsByName.containsKey(name)) {\n\t\t\t\tthrow new DuplicateNameException(name);\n\t\t\t}\n\t\t\tDBTraceAddressPropertyEntry ent = propertyStore.create();\n\t\t\tent.set(name, valueClass);\n\t\t\tAbstractDBTracePropertyMap<T, ?> map = doCreateMap(name, OpenMode.CREATE, valueClass);\n\t\t\tent.map = map;\n\t\t\tpropertyMapsByName.put(name, map);\n\t\t\treturn map;\n\t\t}\n\t}\n\n\t@Override\n\t@SuppressWarnings(\"unchecked\")\n\tpublic <T> AbstractDBTracePropertyMap<T, ?> getPropertyMap(String name, Class<T> valueClass) {\n\t\ttry (LockHold hold = LockHold.lock(lock.readLock())) {\n\t\t\tAbstractDBTracePropertyMap<?, ?> map = propertyMapsByName.get(name);\n\t\t\tif (map == null) {\n\t\t\t\treturn null;\n\t\t\t}","sourceCodeStart":157,"sourceCodeEnd":193,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/property/DBTraceAddressPropertyManager.java#L157-L193","documentation":"Thrown as DuplicateNameException by createPropertyMap when a property map with the given name already exists in propertyMapsByName. The message is the bare name. This enforces name uniqueness per trace for address property maps. Callers are expected to handle the checked DuplicateNameException.","triggerScenarios":"Two calls to createPropertyMap(\"MyProp\", ...) on the same trace, or a name collision with a previously-deserialized persisted property map.","commonSituations":"Reloading a trace that already persisted the property; concurrent plugins both trying to register the same property name; re-running an import script without checking existence first.","solutions":["Use getOrCreatePropertyMap(name, valueClass) instead of createPropertyMap to idempotently fetch or create.","Pre-check with getPropertyMap(name) and skip creation if non-null.","Catch DuplicateNameException and fall back to getPropertyMap."],"exampleFix":"// before\nAbstractDBTracePropertyMap<String,?> map =\n    mgr.createPropertyMap(\"note\", String.class);\n// after\nAbstractDBTracePropertyMap<String,?> map =\n    mgr.getOrCreatePropertyMap(\"note\", String.class);","handlingStrategy":"validation","validationCode":"if (mgr.getPropertyMap(name) != null) {\n    return mgr.getPropertyMap(name, valueClass);\n}\nreturn mgr.createPropertyMap(name, valueClass);","typeGuard":null,"tryCatchPattern":"try { return mgr.createPropertyMap(name, cls); }\ncatch (DuplicateNameException e) { return mgr.getPropertyMap(name, cls); }","preventionTips":["Prefer getOrCreatePropertyMap over createPropertyMap.","Check existence before creating in idempotent scripts."],"tags":["property-map","duplicate","checked-exception"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}