{"record":{"id":"d5769332114c8d75","repo":"NationalSecurityAgency/ghidra","slug":"section-path-must-be-a-successor-of-this-module-s","errorCode":null,"errorMessage":"Section path must be a successor of this module's path","messagePattern":"Section path must be a successor of this module's path","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/module/DBTraceModule.java","lineNumber":103,"sourceCode":"\tpublic DBTraceModule(DBTraceObject object) {\n\t\tthis.object = object;\n\n\t\ttranslator = new ModuleChangeTranslator(object, this);\n\t}\n\n\t@Override\n\tpublic Trace getTrace() {\n\t\treturn object.getTrace();\n\t}\n\n\t@Override\n\tpublic TraceSection addSection(long snap, String sectionPath, String sectionName,\n\t\t\tAddressRange range) throws DuplicateNameException {\n\t\ttry (LockHold hold = object.getTrace().lockWrite()) {\n\t\t\tDBTraceObjectManager manager = object.getManager();\n\t\t\tKeyPath sectionKeyList = KeyPath.parse(sectionPath);\n\t\t\tif (!object.getCanonicalPath().isAncestor(sectionKeyList)) {\n\t\t\t\tthrow new IllegalArgumentException(\n\t\t\t\t\t\"Section path must be a successor of this module's path\");\n\t\t\t}\n\t\t\treturn manager.addSection(sectionPath, sectionName, Lifespan.nowOn(snap), range);\n\t\t}\n\t}\n\n\t@Override\n\tpublic String getPath() {\n\t\treturn object.getCanonicalPath().toString();\n\t}\n\n\t@Override\n\tpublic void setName(Lifespan lifespan, String name) {\n\t\tobject.setValue(lifespan, KEY_MODULE_NAME, name);\n\t}\n\n\t@Override\n\tpublic void setName(long snap, String name) {","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/module/DBTraceModule.java#L85-L121","documentation":"Thrown by DBTraceModule.addSection when the provided sectionPath (parsed as a KeyPath) is not a descendant (successor) of the module's canonical path in the trace object tree. Ghidra traces organize modules and sections as objects in a path hierarchy, so a section must live underneath its parent module's key path.","triggerScenarios":"Calling addSection(snap, sectionPath, sectionName, range) where sectionPath does not start with / is a child of the module's own canonical path. For example the module is at 'Modules[1]' but sectionPath is 'OtherModule[]/Sections[0]' or a top-level key.","commonSituations":"Constructing section paths manually with string concatenation and getting the parent prefix wrong. Copying a section path from one module and reusing it on another module without adjusting the prefix. Misunderstanding the KeyPath convention (e.g. omitting the module key segment).","solutions":["Build the section path by appending the section key to the module's canonical path: module.getCanonicalPath().key(sectionKey) or equivalent path-builder API.","Verify with object.getCanonicalPath().isAncestor(KeyPath.parse(sectionPath)) before calling addSection.","Use the module's getPath() to derive the prefix instead of hardcoding the path string."],"exampleFix":"// before\nString sectionPath = \"Sections[]/0\";\nmodule.addSection(snap, sectionPath, \".text\", range);\n\n// after\nKeyPath basePath = module.getObject().getCanonicalPath();\nString sectionPath = basePath.key(\"Sections[]\").index(0).toString();\nmodule.addSection(snap, sectionPath, \".text\", range);","handlingStrategy":"validation","validationCode":"// Verify the section path is a descendant of the module's path before addSection\nKeyPath modulePath = module.getObject().getCanonicalPath();\nKeyPath sectionPath = KeyPath.parse(sectionPathStr);\nif (!modulePath.isAncestor(sectionPath)) {\n    sectionPathStr = modulePath.key(\"Sections[]\").index(0).toString();\n}\nmodule.addSection(snap, sectionPathStr, name, range);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always derive section paths from the module's canonical path, never hardcode them.","Validate isAncestor before calling addSection.","Use the path-builder API to append section keys rather than string concatenation."],"tags":["trace-modeling","module","section","path","validation","ghidra"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}