NationalSecurityAgency/ghidra · error · TraceConflictedMappingException

Conflicting mappings for {}

Error message

Conflicting mappings for {}

What it means

When adding multiple identity mappings in a loop, addMapping(..., truncateExisting=false) is called per range. Any range that hits an overlapping existing mapping throws TraceConflictedMappingException; these are collected into failures/conflicts. After the loop, if any failures occurred, a single TraceConflictedMappingException("Conflicting mappings for " + failures, conflicts) is thrown listing the conflicting ranges.

Source

Thrown at Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/service/modules/DebuggerStaticMappingUtils.java:234

					extrema.getMin().getOffset(), extrema.getMax().getOffset());
			if (fromRange == null) {
				continue;
			}
			try {
				addMapping(
					new DefaultTraceLocation(from, null, lifespan, fromRange.getMinAddress()),
					new ProgramLocation(toProgram, extrema.getMin()), fromRange.getLength(),
					truncateExisting);
			}
			catch (TraceConflictedMappingException e) {
				failures.add(fromRange);
				conflicts.addAll(e.getConflicts());
				Msg.error(DebuggerStaticMappingUtils.class,
					"Could not add identity mapping " + fromRange + ": " + e.getMessage());
			}
		}
		if (!failures.isEmpty()) {
			throw new TraceConflictedMappingException("Conflicting mappings for " + failures,
				conflicts);
		}
	}

	protected static AddressRange clippedRange(Trace trace, String spaceName, long min,
			long max) {
		AddressSpace space = trace.getBaseAddressFactory().getAddressSpace(spaceName);
		if (space == null) {
			return null;
		}
		Address spaceMax = space.getMaxAddress();
		if (Long.compareUnsigned(min, spaceMax.getOffset()) > 0) {
			return null;
		}
		if (Long.compareUnsigned(max, spaceMax.getOffset()) > 0) {
			return new AddressRangeImpl(space.getAddress(min), spaceMax);
		}
		return new AddressRangeImpl(space.getAddress(min), space.getAddress(max));

View on GitHub (pinned to d5f144c24d)

Solutions

  1. Pass truncateExisting=true to delete or truncate the lifespan of overlapping existing mappings.
  2. Before bulk mapping, clear the conflicting existing mappings (delete or shrink their lifespan).
  3. Catch TraceConflictedMappingException and use getConflicts() to report/resolve the specific overlapping ranges, then retry with truncation.

Example fix

// before
DebuggerStaticMappingUtils.addIdentityMappings(from, toProgram, ranges, false);
// throws: Conflicting mappings for [...]

// after
DebuggerStaticMappingUtils.addIdentityMappings(from, toProgram, ranges, true); // truncate existing
Defensive patterns

Strategy: try-catch

Validate before calling

// Before bulk identity mapping, optionally clear/truncate existing overlaps,
// or decide to pass truncateExisting=true.
boolean truncate = shouldOverwriteExisting(); // domain decision
DebuggerStaticMappingUtils.addIdentityMappings(from, toProgram, ranges, truncate);

Try / catch

try {
    DebuggerStaticMappingUtils.addIdentityMappings(from, toProgram, ranges, false);
} catch (TraceConflictedMappingException e) {
    // e.getConflicts() lists the overlapping mappings
    DebuggerStaticMappingUtils.addIdentityMappings(from, toProgram, ranges, true); // truncate
}

Prevention

When it happens

Trigger: Calling the bulk identity-mapping helper while pre-existing static mappings already cover (or overlap in lifespan) some of the target ranges, with truncateExisting=false. Re-running a mapping operation without first clearing the prior mappings.

Common situations: Re-importing/re-mapping modules over traces that already have mappings from a previous session. Concurrent or repeated mapping commands that overlap. Module map refresh when old mappings were not removed.

Related errors


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