NationalSecurityAgency/ghidra · critical · IllegalStateException

Frame has no index!?

Error message

Frame has no index!?

What it means

Thrown as IllegalStateException by DBTraceStackFrame.getLevel (and similar) when iterating the frame object's key path yields no parseable integer index key. Every stack frame is expected to have an index key in its canonical path; if none of the key path segments decodes via Integer.decode, the frame cannot report its level. This indicates a malformed object path, typically a schema/path construction bug.

Source

Thrown at Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/stack/DBTraceStackFrame.java:92

	@Override
	public int getLevel() {
		KeyPath path = object.getCanonicalPath();
		for (int i = path.size() - 1; i >= 0; i--) {
			String k = path.key(i);
			if (!KeyPath.isIndex(k)) {
				continue;
			}
			String index = KeyPath.parseIndex(k);
			try {
				return Integer.decode(index);
				// TODO: Perhaps just have an attribute that is its level?
			}
			catch (NumberFormatException e) {
				// fall to preceding key
			}
		}
		throw new IllegalStateException("Frame has no index!?");
	}

	@Override
	public Address getProgramCounter(long snap) {
		return TraceObjectInterfaceUtils.getValue(object, snap, KEY_PC, Address.class, null);
	}

	@Override
	public void setProgramCounter(Lifespan span, Address pc) {
		try (LockHold hold = object.getTrace().lockWrite()) {
			if (pc == Address.NO_ADDRESS) {
				pc = null;
			}
			object.setValue(span, KEY_PC, pc);
		}
	}

	@Override

View on GitHub (pinned to d5f144c24d)

Solutions

  1. Create frames only via TraceStack.addFrame / the stack manager so the index key is set correctly.
  2. If you read frames, guard for IllegalStateException and skip frames with non-index paths.
  3. Repair the object path so it contains a decimal integer index segment.
Defensive patterns

Strategy: try-catch

Validate before calling

boolean hasIndex = KeyPath.isIndex(frame.getCanonicalPath().getKey(0));
if (!hasIndex) { /* skip frame, it lacks a level key */ }

Try / catch

try { int lvl = frame.getLevel(); }
catch (IllegalStateException e) { /* frame path has no index */ }

Prevention

When it happens

Trigger: A TraceStackFrame object whose canonical path keys are all string-named (no index), or whose index uses a non-decimal encoding the parser skips. Reached when a frame object was created via raw object API instead of the stack manager.

Common situations: Direct manipulation of trace objects bypassing DBTraceStackManager; schema changes that switched frame keys from indices to names; partial/corrupt object trees.

Related errors


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