{"record":{"id":"15b6fb5b6a8d0ed6","repo":"NationalSecurityAgency/ghidra","slug":"given-bookmark-is-not-part-of-this-trace","errorCode":null,"errorMessage":"Given bookmark is not part of this trace","messagePattern":"Given bookmark is not part of this trace","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/program/DBTraceProgramViewBookmarkManager.java","lineNumber":128,"sourceCode":"\t}\n\n\tprotected void doDeleteOrTruncateLifespan(TraceBookmark bm) {\n\t\tLifespan lifespan = bm.getLifespan();\n\t\tif (!lifespan.contains(program.snap)) {\n\t\t\tthrow new IllegalArgumentException(\"Given bookmark is not present at this view's snap\");\n\t\t}\n\t\tif (lifespan.lmin() == program.snap) {\n\t\t\tbm.delete();\n\t\t}\n\t\telse {\n\t\t\tbm.setLifespan(lifespan.intersect(Lifespan.before(program.snap)));\n\t\t}\n\t}\n\n\t@Override\n\tpublic void removeBookmark(Bookmark bookmark) {\n\t\tif (!(bookmark instanceof DBTraceBookmark)) {\n\t\t\tthrow new IllegalArgumentException(\"Given bookmark is not part of this trace\");\n\t\t}\n\t\tDBTraceBookmark dbBookmark = (DBTraceBookmark) bookmark;\n\t\tif (dbBookmark.getTrace() != program.trace) {\n\t\t\tthrow new IllegalArgumentException(\"Given bookmark is not part of this trace\");\n\t\t}\n\t\tdoDeleteOrTruncateLifespan(dbBookmark);\n\t}\n\n\t@Override\n\tpublic void removeBookmarks(String type) {\n\t\ttry (LockHold hold = program.trace.lockWrite()) {\n\t\t\tfor (DBTraceBookmark bm : bookmarkManager.getBookmarksByType(type)) {\n\t\t\t\tif (!bm.getLifespan().contains(program.snap)) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tdoDeleteOrTruncateLifespan(bm);\n\t\t\t}\n\t\t}","sourceCodeStart":110,"sourceCodeEnd":146,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/program/DBTraceProgramViewBookmarkManager.java#L110-L146","documentation":"Thrown as IllegalArgumentException by removeBookmark when the passed Bookmark object is not an instance of DBTraceBookmark. The trace bookmark manager only operates on trace-owned bookmark objects; a bookmark from a regular Program or an unrelated implementation cannot be managed by the trace.","triggerScenarios":"Calling removeBookmark with a Bookmark object obtained from a different (non-trace) Program, or a mock/test bookmark that is not a DBTraceBookmark.","commonSituations":"Mixing bookmarks from a static Program with the trace program view. Passing a Program bookmark to the trace bookmark manager. Using a generic Bookmark handle across program types.","solutions":["Only pass bookmarks obtained from the trace's own bookmark manager to removeBookmark.","Type-check: verify bookmark instanceof DBTraceBookmark before calling.","If you have a static-program bookmark, find or create the corresponding trace bookmark first."],"exampleFix":"// before\nbookmarkManager.removeBookmark(someProgramBookmark);\n\n// after\nif (bookmark instanceof DBTraceBookmark) {\n    bookmarkManager.removeBookmark((DBTraceBookmark) bookmark);\n}","handlingStrategy":"type-guard","validationCode":"if (bookmark instanceof DBTraceBookmark) {\n    bookmarkManager.removeBookmark((DBTraceBookmark) bookmark);\n}","typeGuard":"static boolean isTraceBookmark(Bookmark b) {\n    return b instanceof DBTraceBookmark;\n}","tryCatchPattern":null,"preventionTips":["Only pass bookmarks obtained from the trace's own bookmark manager.","Type-check Bookmark before calling removeBookmark.","Do not mix static-Program bookmarks with trace bookmark operations."],"tags":["trace-modeling","bookmark","type-check","validation","ghidra"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}