{"record":{"id":"507f505e4c4aeea8","repo":"NationalSecurityAgency/ghidra","slug":"there-is-no-trace","errorCode":null,"errorMessage":"There is no trace","messagePattern":"There is no trace","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"Ghidra/Debug/Debugger-api/src/main/java/ghidra/debug/flatapi/FlatDebuggerAPI.java","lineNumber":194,"sourceCode":"\t */\n\tdefault Trace requireCurrentTrace() {\n\t\tTrace trace = getCurrentTrace();\n\t\tif (trace == null) {\n\t\t\tthrow new IllegalStateException(\"There is no current trace\");\n\t\t}\n\t\treturn trace;\n\t}\n\n\t/**\n\t * Require that the given trace is not null\n\t * \n\t * @param trace the trace\n\t * @return the trace\n\t * @throws IllegalStateException if the trace is null\n\t */\n\tdefault Trace requireTrace(Trace trace) {\n\t\tif (trace == null) {\n\t\t\tthrow new IllegalStateException(\"There is no trace\");\n\t\t}\n\t\treturn trace;\n\t}\n\n\t/**\n\t * Get the current trace platform\n\t * \n\t * @return the trace platform, or null\n\t */\n\tdefault TracePlatform getCurrentPlatform() {\n\t\treturn getTraceManager().getCurrentPlatform();\n\t}\n\n\t/**\n\t * Get the current trace platform, throwing an exception if there isn't one\n\t * \n\t * @return the trace platform\n\t * @throws IllegalStateException if there is no current trace platform","sourceCodeStart":176,"sourceCodeEnd":212,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Debug/Debugger-api/src/main/java/ghidra/debug/flatapi/FlatDebuggerAPI.java#L176-L212","documentation":"Thrown by FlatDebuggerAPI.requireTrace(trace) when the caller passes a null trace reference. This is a null-check guard for an explicitly supplied trace argument, distinct from requireCurrentTrace() which checks the active trace.","triggerScenarios":"Calling requireTrace(someTrace) where someTrace is null, e.g., a variable holding the result of a lookup that returned null.","commonSituations":"Passing a trace obtained from a search/lookup that found nothing; chaining lookups where an intermediate result was null; logic errors that leave the trace variable unassigned.","solutions":["Check the trace variable for null before passing it to requireTrace().","Trace the source of the trace reference and handle the not-found case explicitly.","Use getCurrentTrace() instead if you meant the active trace."],"exampleFix":"// before\nTrace t = findTraceById(id); // may return null\nrequireTrace(t); // throws\n\n// after\nTrace t = findTraceById(id);\nif (t == null) {\n    println(\"No trace for id \" + id);\n    return;\n}","handlingStrategy":"validation","validationCode":"if (trace == null) {\n    println(\"Trace reference is null\");\n    return;\n}","typeGuard":"static boolean isNonNullTrace(Trace t) {\n    return t != null;\n}","tryCatchPattern":"try {\n    requireTrace(trace);\n} catch (IllegalStateException e) {\n    if (e.getMessage().equals(\"There is no trace\")) {\n        // fall back to getCurrentTrace()\n        trace = getCurrentTrace();\n    } else throw e;\n}","preventionTips":["Null-check trace variables right after the lookup that produced them.","Prefer getCurrentTrace() when you mean the active trace."],"tags":["flat-debugger-api","trace","null-check","debugger"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}