NationalSecurityAgency/ghidra · warning · DuplicateNameException

{name}

Error message

{name}

What it means

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.

Source

Thrown at Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/property/DBTraceAddressPropertyManager.java:175

					tableName, dbh, openMode, lock, TaskMonitor.DUMMY, baseLanguage, trace,
					threadManager, saveableClass);
			}
		}
		catch (IOException e) {
			dbError(e);
		}
		catch (VersionException e) {
			throw new AssertionError(e);
		}
		throw new IllegalArgumentException("Unsupported value class: " + valueClass);
	}

	@Override
	public <T> AbstractDBTracePropertyMap<T, ?> createPropertyMap(String name, Class<T> valueClass)
			throws DuplicateNameException {
		try (LockHold hold = LockHold.lock(lock.writeLock())) {
			if (propertyMapsByName.containsKey(name)) {
				throw new DuplicateNameException(name);
			}
			DBTraceAddressPropertyEntry ent = propertyStore.create();
			ent.set(name, valueClass);
			AbstractDBTracePropertyMap<T, ?> map = doCreateMap(name, OpenMode.CREATE, valueClass);
			ent.map = map;
			propertyMapsByName.put(name, map);
			return map;
		}
	}

	@Override
	@SuppressWarnings("unchecked")
	public <T> AbstractDBTracePropertyMap<T, ?> getPropertyMap(String name, Class<T> valueClass) {
		try (LockHold hold = LockHold.lock(lock.readLock())) {
			AbstractDBTracePropertyMap<?, ?> map = propertyMapsByName.get(name);
			if (map == null) {
				return null;
			}

View on GitHub (pinned to d5f144c24d)

Solutions

  1. Use getOrCreatePropertyMap(name, valueClass) instead of createPropertyMap to idempotently fetch or create.
  2. Pre-check with getPropertyMap(name) and skip creation if non-null.
  3. Catch DuplicateNameException and fall back to getPropertyMap.

Example fix

// before
AbstractDBTracePropertyMap<String,?> map =
    mgr.createPropertyMap("note", String.class);
// after
AbstractDBTracePropertyMap<String,?> map =
    mgr.getOrCreatePropertyMap("note", String.class);
Defensive patterns

Strategy: validation

Validate before calling

if (mgr.getPropertyMap(name) != null) {
    return mgr.getPropertyMap(name, valueClass);
}
return mgr.createPropertyMap(name, valueClass);

Try / catch

try { return mgr.createPropertyMap(name, cls); }
catch (DuplicateNameException e) { return mgr.getPropertyMap(name, cls); }

Prevention

When it happens

Trigger: Two calls to createPropertyMap("MyProp", ...) on the same trace, or a name collision with a previously-deserialized persisted property map.

Common situations: 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.

Related errors


AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14). Data as JSON: /api/errors/f7634ac7c7d66ccd. Report an issue: GitHub.