{"record":{"id":"7d35e6dbd3069ad9","repo":"NationalSecurityAgency/ghidra","slug":"could-not-determine-where-to-create-new-frame","errorCode":null,"errorMessage":"Could not determine where to create new frame","messagePattern":"Could not determine where to create new frame","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"critical","filePath":"Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/stack/DBTraceStack.java","lineNumber":104,"sourceCode":"\t@Override\n\tpublic int getDepth(long snap) {\n\t\ttry (LockHold hold = object.getTrace().lockRead()) {\n\t\t\treturn object\n\t\t\t\t\t.querySuccessorsInterface(Lifespan.at(snap), TraceStackFrame.class, true)\n\t\t\t\t\t.map(f -> f.getLevel())\n\t\t\t\t\t.reduce(Integer::max)\n\t\t\t\t\t.map(m -> m + 1)\n\t\t\t\t\t.orElse(0);\n\t\t}\n\t}\n\n\tprotected TraceStackFrame doAddStackFrame(long snap, int level) {\n\t\ttry (LockHold hold = object.getTrace().lockWrite()) {\n\t\t\tPathFilter filter =\n\t\t\t\tobject.getSchema().searchFor(TraceStackFrame.class, true);\n\t\t\tKeyPath relPath = filter.applyKeys(KeyPath.makeIndex(level)).getSingletonPath();\n\t\t\tif (relPath == null) {\n\t\t\t\tthrow new IllegalStateException(\"Could not determine where to create new frame\");\n\t\t\t}\n\t\t\tKeyPath path = object.getCanonicalPath().extend(relPath);\n\t\t\treturn object.getManager().addStackFrame(path, snap);\n\t\t}\n\t}\n\n\tprotected void copyFrameAttributes(long snap, TraceStackFrame from, TraceStackFrame to) {\n\t\t// Program Counter is the only attribute?\n\t\tto.setProgramCounter(Lifespan.nowOn(snap), from.getProgramCounter(snap));\n\t}\n\n\tprotected void shiftFrameAttributes(long snap, int from, int to, int count,\n\t\t\tList<TraceStackFrame> frames) {\n\t\tif (from == to) {\n\t\t\treturn;\n\t\t}\n\t\tif (from < to) {\n\t\t\tfor (int i = count - 1; i >= 0; i--) {","sourceCodeStart":86,"sourceCodeEnd":122,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/stack/DBTraceStack.java#L86-L122","documentation":"Thrown as IllegalStateException by DBTraceStack.doAddStackFrame when the schema search filter, after applying the level as an index key, yields no single canonical relative path. This means the trace's object schema does not define a placeable location for a TraceStackFrame at the given level — the schema is missing or misconfigured the stack-frame child relation.","triggerScenarios":"Calling stack.addFrame(level) on a trace whose schema was not configured to allow indexed TraceStackFrame children under the stack object. Corrupted or incomplete schema; a custom schema that omitted the frame element.","commonSituations":"Loading a trace created by an older/newer Ghidra version whose schema differs; using a target connector that emits no stack schema; programmatic schema manipulation.","solutions":["Verify the trace's schema includes a TraceStackFrame relation reachable by searchFor(TraceStackFrame.class, true).","Recreate the trace with the current framework schema if it was authored by an incompatible version.","Report the schema configuration; this is generally not recoverable at runtime via addFrame."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"PathFilter f = stack.getSchema().searchFor(TraceStackFrame.class, true);\nif (f.applyKeys(KeyPath.makeIndex(level)).getSingletonPath() == null) {\n    // schema cannot place a frame here; abort or repair schema\n}","typeGuard":null,"tryCatchPattern":"try { stack.addFrame(level); }\ncatch (IllegalStateException e) {\n    if (e.getMessage().contains(\"Could not determine\")) { /* schema issue */ }\n    else throw e;\n}","preventionTips":["Use traces created with the current framework schema.","Treat this as a schema/configuration defect, not transient."],"tags":["stack","schema","object-model","illegal-state"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}