{"record":{"id":"f011913d3eabc366","repo":"NationalSecurityAgency/ghidra","slug":"endpoint-cannot-be-1","errorCode":null,"errorMessage":"endpoint cannot be -1","messagePattern":"endpoint cannot be -1","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/module/DBTraceStaticMapping.java","lineNumber":141,"sourceCode":"\tprotected void fresh(boolean created) throws IOException {\n\t\tif (created) {\n\t\t\treturn;\n\t\t}\n\t\ttry {\n\t\t\tthis.traceRange =\n\t\t\t\tnew AddressRangeImpl(traceAddress, traceAddress.addNoWrap(length - 1));\n\t\t}\n\t\tcatch (AddressOverflowException e) {\n\t\t\tthrow new AssertionError(e);\n\t\t}\n\t\tthis.shift = traceAddress.getOffset() - parseOffset(staticAddress);\n\t\tthis.lifespan = Lifespan.span(startSnap, endSnap);\n\t}\n\n\tvoid set(AddressRange traceRange, Lifespan lifespan, URL staticProgramURL,\n\t\t\tString staticAddress) {\n\t\tif (startSnap == -1) {\n\t\t\tthrow new IllegalArgumentException(\"endpoint cannot be -1\");\n\t\t}\n\t\tthis.traceRange = traceRange;\n\t\tthis.traceAddress = traceRange.getMinAddress();\n\t\tthis.length = traceRange.getLength();\n\t\tthis.lifespan = lifespan;\n\t\tthis.startSnap = lifespan.lmin();\n\t\tthis.endSnap = lifespan.lmax();\n\t\tthis.staticProgramURL = staticProgramURL;\n\t\tthis.staticAddress = staticAddress;\n\t\tupdate(TRACE_ADDRESS_COLUMN, LENGTH_COLUMN, START_SNAP_COLUMN, END_SNAP_COLUMN,\n\t\t\tSTATIC_PROGRAM_COLUMN, STATIC_ADDRESS_COLUMN);\n\n\t\tthis.shift = traceAddress.getOffset() - parseOffset(staticAddress);\n\t}\n\n\t@Override\n\tpublic DBTraceOverlaySpaceAdapter getOverlaySpaceAdapter() {\n\t\treturn manager.overlayAdapter;","sourceCodeStart":123,"sourceCodeEnd":159,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/module/DBTraceStaticMapping.java#L123-L159","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Always create and populate mappings through DBTraceStaticMappingManager.add(range, lifespan, url, address) which sets the lifespan correctly; do not call DBTraceStaticMapping.set directly.","If migrating or repairing records, ensure the Lifespan passed has a non-negative minimum before persisting.","Run a database integrity check / upgrade tool on the trace file if StartSnap columns contain -1 in a production trace."],"exampleFix":"// before\nDBTraceStaticMapping m = mappingStore.create();\nm.set(range, Lifespan.ALL, url, addr); // startSnap still -1 internally\n\n// after\nDBTraceStaticMapping m = mappingManager.add(range, lifespan, url, addr); // manager sets lifespan properly","handlingStrategy":"validation","validationCode":"// Do not call DBTraceStaticMapping.set directly; use the manager\n// The manager validates and sets the lifespan correctly:\nDBTraceStaticMapping m = mappingManager.add(range, lifespan, programURL, staticAddr);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always create mappings via DBTraceStaticMappingManager.add, never by calling set on a raw record.","Ensure the Lifespan has a valid (non -1) minimum before persisting.","Run a DB integrity/upgrade check if StartSnap columns are -1 in existing traces."],"tags":["trace-modeling","mapping","lifespan","internal","data-integrity","ghidra"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}