{"record":{"id":"c0f3b8154153f2f3","repo":"NationalSecurityAgency/ghidra","slug":"cannot-use-program-view-to-set-the-trace-name","errorCode":null,"errorMessage":"Cannot use program view to set the trace name","messagePattern":"Cannot use program view to set the trace name","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/program/DBTraceProgramView.java","lineNumber":1209,"sourceCode":"\n\t@Override\n\tpublic boolean removePrivateEventQueue(EventQueueID id) {\n\t\treturn eventQueues.removePrivateEventQueue(id);\n\t}\n\n\t@Override\n\tpublic String getDescription() {\n\t\treturn trace.getDescription() + \" (at snap \" + snap + \")\";\n\t}\n\n\t@Override\n\tpublic String getName() {\n\t\treturn trace.getName() + \" (snap \" + snap + \")\";\n\t}\n\n\t@Override\n\tpublic void setName(String name) {\n\t\tthrow new UnsupportedOperationException(\"Cannot use program view to set the trace name\");\n\t}\n\n\t@Override\n\tpublic DomainFile getDomainFile() {\n\t\treturn trace.getDomainFile();\n\t}\n\n\t@Override\n\tpublic boolean addConsumer(Object consumer) {\n\t\treturn trace.addConsumer(consumer);\n\t}\n\n\t@Override\n\tpublic ArrayList<Object> getConsumerList() {\n\t\treturn trace.getConsumerList();\n\t}\n\n\t@Override","sourceCodeStart":1191,"sourceCodeEnd":1227,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/program/DBTraceProgramView.java#L1191-L1227","documentation":"Thrown as UnsupportedOperationException by setName on a DBTraceProgramView because the view is a read-oriented snapshot window into the trace and cannot rename the underlying trace. The trace's name is a domain-object property that must be set on the trace (or its DomainFile), not through the per-snap program view.","triggerScenarios":"Calling programView.setName(name) on a DBTraceProgramView obtained from a trace.","commonSituations":"Running rename logic that calls setName on any Program without distinguishing trace views. UI/script code that assumes the Program handle is the canonical owner of the name.","solutions":["Set the name on the trace itself: trace.setName(name), or on the DomainFile.","Detect DBTraceProgramView and route the rename to the underlying trace object.","Avoid generic 'rename Program' helpers that call setName blindly; add a type check."],"exampleFix":"// before\nprogramView.setName(\"newName\");\n\n// after\nif (programView instanceof DBTraceProgramView tpv) {\n    tpv.getTrace().setName(\"newName\");\n} else {\n    program.setName(\"newName\");\n}","handlingStrategy":"validation","validationCode":"// Route setName to the trace, not the view\nif (program instanceof DBTraceProgramView tpv) {\n    tpv.getTrace().setName(name);\n} else {\n    program.setName(name);\n}","typeGuard":"static boolean isTraceProgramView(Program p) {\n    return p instanceof DBTraceProgramView;\n}","tryCatchPattern":null,"preventionTips":["Set the name on the trace or DomainFile, not the program view.","Type-check Program handles before generic rename calls.","Document that trace views are read-oriented for naming."],"tags":["trace-modeling","name","unsupported-operation","ghidra"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}