{"record":{"id":"f21a6f3e243f7c54","repo":"NationalSecurityAgency/ghidra","slug":"createtrace-path-name-cannot-be-empty","errorCode":null,"errorMessage":"CreateTrace: path (name) cannot be empty","messagePattern":"CreateTrace: path \\(name\\) cannot be empty","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"Ghidra/Debug/Debugger-rmi-trace/src/main/java/ghidra/app/plugin/core/debug/service/tracermi/TraceRmiHandler.java","lineNumber":869,"sourceCode":"\t\tOpenTrace open = requireOpenTrace(req.getOid());\n\t\tXmlSchemaContext ctx;\n\t\ttry {\n\t\t\tctx = XmlSchemaContext.deserialize(req.getSchemaContext());\n\t\t}\n\t\tcatch (Exception e) {\n\t\t\tthrow new InvalidSchemaError(e);\n\t\t}\n\t\tTraceObjectValue value = open.trace.getObjectManager()\n\t\t\t\t.createRootObject(ctx.getSchema(new SchemaName(req.getRootSchema())));\n\t\treturn ReplyCreateObject.newBuilder().setObject(makeObjSpec(value.getChild())).build();\n\t}\n\n\tprotected ReplyCreateTrace handleCreateTrace(RequestCreateTrace req)\n\t\t\tthrows InvalidNameException, IOException, CancelledException {\n\t\tDomainFolder traces = getOrCreateNewTracesFolder();\n\t\tList<String> path = sanitizePath(req.getPath().getPath());\n\t\tif (path.isEmpty()) {\n\t\t\tthrow new IllegalArgumentException(\"CreateTrace: path (name) cannot be empty\");\n\t\t}\n\t\tDomainFolder folder = createFolders(traces, path.subList(0, path.size() - 1));\n\t\tCompilerSpec cs = requireCompilerSpec(req.getLanguage(), req.getCompiler());\n\t\tDBTrace trace = new DBTrace(path.get(path.size() - 1), cs, this);\n\t\tTraceRmiTarget target = new TraceRmiTarget(plugin.getTool(), this, trace);\n\t\tDoId doId = requireAvailableDoId(req.getOid());\n\t\topenTraces.put(new OpenTrace(doId, trace, target));\n\t\tcreateDeconflictedFile(folder, trace);\n\t\tdoActivate(null, trace, null);\n\t\treturn ReplyCreateTrace.getDefaultInstance();\n\t}\n\n\tprotected static String sanitizeName(String name) {\n\t\tStringBuffer buf = new StringBuffer(name.length());\n\t\tfor (int i = 0; i < name.length(); i++) {\n\t\t\tchar c = name.charAt(i);\n\t\t\tbuf.append(LocalFileSystem.isValidNameCharacter(c) ? c : '_');\n\t\t}","sourceCodeStart":851,"sourceCodeEnd":887,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Debug/Debugger-rmi-trace/src/main/java/ghidra/app/plugin/core/debug/service/tracermi/TraceRmiHandler.java#L851-L887","documentation":"Thrown by TraceRmiHandler.handleCreateTrace after sanitizePath() reduces the requested path to an empty list. A CreateTrace request must name the new trace (the last path element is the file name), so an empty path is rejected with IllegalArgumentException. The path is sanitized (stripping empties from components like '//' or trailing '/'), which can turn a non-empty string into an empty list.","triggerScenarios":"The client sends RequestCreateTrace with an empty path string, a path of only slashes ('/', '//'), or a path whose components are all empty after sanitization.","commonSituations":"Client forgets to set the trace name; path built by joining an empty list; user supplied a blank name in the UI/script; path is just whitespace/slashes.","solutions":["Provide a non-empty name as the final path component when building the CreateTrace request.","Validate the path is non-empty and contains at least one non-slash segment before sending.","Strip slashes/whitespace client-side and reject empty results before the call."],"exampleFix":"# before\npath = ''  # or '//' -> sanitized to empty\nconn.create_trace(path, lang, compiler)\n\n# after\nname = 'my_trace'\nassert name and name.strip('/'), 'trace name required'\nconn.create_trace(name, lang, compiler)","handlingStrategy":"validation","validationCode":"List<String> path = sanitizePath(req.getPath().getPath());\nif (path.isEmpty()) {\n    throw new IllegalArgumentException(\"trace name required\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    handler.createTrace(req);\n} catch (IllegalArgumentException e) {\n    // empty path; prompt user / supply a name and retry\n}","preventionTips":["Always set a non-empty final path component for the trace name.","Validate the name client-side, stripping slashes and rejecting empties.","Avoid building paths by joining lists that may be empty."],"tags":["trace-rmi","create-trace","validation","path"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}