NationalSecurityAgency/ghidra · error · IllegalArgumentException

endpoint cannot be -1

Error message

endpoint cannot be -1

What it means

Thrown by DBTraceStaticMapping.set when the startSnap field is -1 at the time set() is called. The startSnap column is initialized to -1 (sentinel for un-set) and set() requires a valid lifespan with a real minimum endpoint. This is an internal consistency guard indicating the mapping record's lifespan has not been properly established yet, or a corrupted/stale DB record where the StartSnap column is -1.

Source

Thrown at Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/module/DBTraceStaticMapping.java:141

	protected void fresh(boolean created) throws IOException {
		if (created) {
			return;
		}
		try {
			this.traceRange =
				new AddressRangeImpl(traceAddress, traceAddress.addNoWrap(length - 1));
		}
		catch (AddressOverflowException e) {
			throw new AssertionError(e);
		}
		this.shift = traceAddress.getOffset() - parseOffset(staticAddress);
		this.lifespan = Lifespan.span(startSnap, endSnap);
	}

	void set(AddressRange traceRange, Lifespan lifespan, URL staticProgramURL,
			String staticAddress) {
		if (startSnap == -1) {
			throw new IllegalArgumentException("endpoint cannot be -1");
		}
		this.traceRange = traceRange;
		this.traceAddress = traceRange.getMinAddress();
		this.length = traceRange.getLength();
		this.lifespan = lifespan;
		this.startSnap = lifespan.lmin();
		this.endSnap = lifespan.lmax();
		this.staticProgramURL = staticProgramURL;
		this.staticAddress = staticAddress;
		update(TRACE_ADDRESS_COLUMN, LENGTH_COLUMN, START_SNAP_COLUMN, END_SNAP_COLUMN,
			STATIC_PROGRAM_COLUMN, STATIC_ADDRESS_COLUMN);

		this.shift = traceAddress.getOffset() - parseOffset(staticAddress);
	}

	@Override
	public DBTraceOverlaySpaceAdapter getOverlaySpaceAdapter() {
		return manager.overlayAdapter;

View on GitHub (pinned to d5f144c24d)

Solutions

  1. Always create and populate mappings through DBTraceStaticMappingManager.add(range, lifespan, url, address) which sets the lifespan correctly; do not call DBTraceStaticMapping.set directly.
  2. If migrating or repairing records, ensure the Lifespan passed has a non-negative minimum before persisting.
  3. Run a database integrity check / upgrade tool on the trace file if StartSnap columns contain -1 in a production trace.

Example fix

// before
DBTraceStaticMapping m = mappingStore.create();
m.set(range, Lifespan.ALL, url, addr); // startSnap still -1 internally

// after
DBTraceStaticMapping m = mappingManager.add(range, lifespan, url, addr); // manager sets lifespan properly
Defensive patterns

Strategy: validation

Validate before calling

// Do not call DBTraceStaticMapping.set directly; use the manager
// The manager validates and sets the lifespan correctly:
DBTraceStaticMapping m = mappingManager.add(range, lifespan, programURL, staticAddr);

Prevention

When it happens

Trigger: Calling mapping.set(...) on a DBTraceStaticMapping whose startSnap is still the default -1 sentinel. This can happen when re-assigning a record that was created but never had its lifespan persisted, or when loading a mapping from a corrupted database where the StartSnap column is -1.

Common situations: Database corruption or partial writes where StartSnap was never stored. Calling the internal set() method directly on a mapping object in a bad state instead of going through DBTraceStaticMappingManager.add(). Version-mismatch where an older DB schema lacks the StartSnap column.

Related errors


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