{"record":{"id":"e0026827a80fdd66","repo":"NationalSecurityAgency/ghidra","slug":"there-is-no-current-trace-view","errorCode":null,"errorMessage":"There is no current trace view","messagePattern":"There is no current trace view","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"Ghidra/Debug/Debugger-api/src/main/java/ghidra/debug/flatapi/FlatDebuggerAPI.java","lineNumber":306,"sourceCode":"\t * give the \"destination\" scratch snapshot. See {@link #getCurrentEmulationSchedule()}.\n\t * \n\t * @see #getCurrentDebuggerCoordinates()\n\t * @return the view\n\t */\n\tdefault TraceProgramView getCurrentView() {\n\t\treturn getTraceManager().getCurrentView();\n\t}\n\n\t/**\n\t * Get the current trace view, throwing an exception if there isn't one\n\t * \n\t * @return the trace view\n\t * @throws IllegalStateException if there is no current trace view\n\t */\n\tdefault TraceProgramView requireCurrentView() {\n\t\tTraceProgramView view = getCurrentView();\n\t\tif (view == null) {\n\t\t\tthrow new IllegalStateException(\"There is no current trace view\");\n\t\t}\n\t\treturn view;\n\t}\n\n\t/**\n\t * Get the current frame, 0 being the innermost\n\t * \n\t * <p>\n\t * If the target doesn't support frames, this will return 0\n\t * \n\t * @see #getCurrentDebuggerCoordinates()\n\t * @return the frame\n\t */\n\tdefault int getCurrentFrame() {\n\t\treturn getTraceManager().getCurrentFrame();\n\t}\n\n\t/**","sourceCodeStart":288,"sourceCodeEnd":324,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Debug/Debugger-api/src/main/java/ghidra/debug/flatapi/FlatDebuggerAPI.java#L288-L324","documentation":"Thrown by FlatDebuggerAPI.requireCurrentView() when there is no current trace program view. The view is an adapter that lets a trace be used as a Program for a chosen snapshot; it requires a current trace.","triggerScenarios":"Calling requireCurrentView() when getCurrentView() returns null, which occurs when no trace is current or the view has not been created.","commonSituations":"No active trace; the trace manager has not yet built a view for the current snapshot; operations that iterate a trace as a Program called before a trace is open.","solutions":["Ensure a trace is current before calling view-dependent methods.","Guard with getCurrentView() != null.","Use getCurrentTrace()/requireCurrentTrace() first, which implies a view can be obtained."],"exampleFix":"// before\nTraceProgramView v = requireCurrentView(); // throws if none\n\n// after\nif (getCurrentTrace() == null) {\n    println(\"No active trace\");\n    return;\n}\nTraceProgramView v = requireCurrentView();","handlingStrategy":"type-guard","validationCode":"TraceProgramView v = getCurrentView();\nif (v == null) {\n    println(\"No current trace view; open a trace first\");\n    return;\n}","typeGuard":"static boolean hasCurrentView(FlatDebuggerAPI api) {\n    return api.getCurrentView() != null;\n}","tryCatchPattern":"try {\n    TraceProgramView v = requireCurrentView();\n} catch (IllegalStateException e) {\n    if (e.getMessage().equals(\"There is no current trace view\")) {\n        // ensure a trace is open, then retry\n    } else throw e;\n}","preventionTips":["Ensure a trace is current before view-dependent operations.","Use getCurrentView() != null as a precondition check."],"tags":["flat-debugger-api","trace-view","program","debugger"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}