NationalSecurityAgency/ghidra · error · IllegalArgumentException
Given bookmark is not present at this view's snap
Error message
Given bookmark is not present at this view's snap
What it means
Thrown as IllegalArgumentException by doDeleteOrTruncateLifespan when the bookmark's lifespan does not contain the current view snap. A trace bookmark lives for a Lifespan of snaps; the program view operates at a single snap. You can only delete or truncate a bookmark that is actually present (alive) at the snap the view is displaying.
Source
Thrown at Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/program/DBTraceProgramViewBookmarkManager.java:115
for (long s : program.viewport.getOrderedSnaps()) {
for (TraceBookmark bm : space.getBookmarksAt(s, addr)) {
if (!type.equals(bm.getTypeString())) {
continue;
}
if (!category.equals(bm.getCategory())) {
continue;
}
return bm;
}
}
return null;
}
}
protected void doDeleteOrTruncateLifespan(TraceBookmark bm) {
Lifespan lifespan = bm.getLifespan();
if (!lifespan.contains(program.snap)) {
throw new IllegalArgumentException("Given bookmark is not present at this view's snap");
}
if (lifespan.lmin() == program.snap) {
bm.delete();
}
else {
bm.setLifespan(lifespan.intersect(Lifespan.before(program.snap)));
}
}
@Override
public void removeBookmark(Bookmark bookmark) {
if (!(bookmark instanceof DBTraceBookmark)) {
throw new IllegalArgumentException("Given bookmark is not part of this trace");
}
DBTraceBookmark dbBookmark = (DBTraceBookmark) bookmark;
if (dbBookmark.getTrace() != program.trace) {
throw new IllegalArgumentException("Given bookmark is not part of this trace");
}View on GitHub (pinned to d5f144c24d)
Solutions
- Verify bm.getLifespan().contains(programView.getSnap()) before attempting to remove or truncate.
- Fetch bookmarks at the view's current snap so they are guaranteed present.
- Re-fetch or recreate the bookmark at the desired snap before deleting.
Example fix
// before
bookmarkManager.removeBookmark(bm);
// after
if (bm.getLifespan().contains(programView.getSnap())) {
bookmarkManager.removeBookmark(bm);
} Defensive patterns
Strategy: validation
Validate before calling
// Verify the bookmark is alive at the view's snap before removing
long snap = programView.getSnap();
if (bm.getLifespan().contains(snap)) {
bookmarkManager.removeBookmark(bm);
} Prevention
- Check lifespan.contains(viewSnap) before removing a bookmark.
- Fetch bookmarks at the view's current snap.
- Do not cache bookmark handles across snap switches.
When it happens
Trigger: Calling removeBookmark (or any path into doDeleteOrTruncateLifespan) for a bookmark whose Lifespan does not enclose program.snap — e.g. the bookmark was created at a later snap or already truncated before the current snap.
Common situations: Removing a bookmark obtained from a different snap than the view's current snap. Operating on a bookmark that expired at an earlier snap. Switching the view's snap after fetching bookmarks and then trying to delete one not alive at the new snap.
Related errors
- Given bookmark is not part of this trace
- Usage: ghidra trace new-snap [SNAP] DESCRIPTION
- More than one state is present in
- Section path must be a successor of this module's path
- Address string should have at most one colon (:)
AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14).
Data as JSON: /api/errors/6925535cf2e50a74.
Report an issue: GitHub.