{"record":{"id":"a1428aa6d5dc7239","repo":"NationalSecurityAgency/ghidra","slug":"frame-has-no-index","errorCode":null,"errorMessage":"Frame has no index!?","messagePattern":"Frame has no index!\\?","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"critical","filePath":"Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/stack/DBTraceStackFrame.java","lineNumber":92,"sourceCode":"\n\t@Override\n\tpublic int getLevel() {\n\t\tKeyPath path = object.getCanonicalPath();\n\t\tfor (int i = path.size() - 1; i >= 0; i--) {\n\t\t\tString k = path.key(i);\n\t\t\tif (!KeyPath.isIndex(k)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tString index = KeyPath.parseIndex(k);\n\t\t\ttry {\n\t\t\t\treturn Integer.decode(index);\n\t\t\t\t// TODO: Perhaps just have an attribute that is its level?\n\t\t\t}\n\t\t\tcatch (NumberFormatException e) {\n\t\t\t\t// fall to preceding key\n\t\t\t}\n\t\t}\n\t\tthrow new IllegalStateException(\"Frame has no index!?\");\n\t}\n\n\t@Override\n\tpublic Address getProgramCounter(long snap) {\n\t\treturn TraceObjectInterfaceUtils.getValue(object, snap, KEY_PC, Address.class, null);\n\t}\n\n\t@Override\n\tpublic void setProgramCounter(Lifespan span, Address pc) {\n\t\ttry (LockHold hold = object.getTrace().lockWrite()) {\n\t\t\tif (pc == Address.NO_ADDRESS) {\n\t\t\t\tpc = null;\n\t\t\t}\n\t\t\tobject.setValue(span, KEY_PC, pc);\n\t\t}\n\t}\n\n\t@Override","sourceCodeStart":74,"sourceCodeEnd":110,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/stack/DBTraceStackFrame.java#L74-L110","documentation":"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.","triggerScenarios":"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.","commonSituations":"Direct manipulation of trace objects bypassing DBTraceStackManager; schema changes that switched frame keys from indices to names; partial/corrupt object trees.","solutions":["Create frames only via TraceStack.addFrame / the stack manager so the index key is set correctly.","If you read frames, guard for IllegalStateException and skip frames with non-index paths.","Repair the object path so it contains a decimal integer index segment."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"boolean hasIndex = KeyPath.isIndex(frame.getCanonicalPath().getKey(0));\nif (!hasIndex) { /* skip frame, it lacks a level key */ }","typeGuard":null,"tryCatchPattern":"try { int lvl = frame.getLevel(); }\ncatch (IllegalStateException e) { /* frame path has no index */ }","preventionTips":["Create frames only via the stack manager.","Guard frame iteration against non-index paths."],"tags":["stack","object-model","path","illegal-state"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}