{"record":{"id":"58cba2074b8b0917","repo":"JetBrains/intellij-community","slug":"no-binding-on-root-component-of-nested-form","errorCode":null,"errorMessage":"No binding on root component of nested form ","messagePattern":"No binding on root component of nested form ","errorType":"validation","errorClass":"CodeGenerationException","httpStatus":null,"severity":"error","filePath":"java/compiler/forms-compiler/src/com/intellij/uiDesigner/compiler/AsmCodeGenerator.java","lineNumber":410,"sourceCode":"      String className;\n      if (lwComponent instanceof LwNestedForm) {\n        LwRootContainer nestedFormContainer;\n        LwNestedForm nestedForm = (LwNestedForm) lwComponent;\n        if (myFormLoader == null) {\n          throw new CodeGenerationException(null, \"Attempt to compile nested form with no nested form loader specified\");\n        }\n        try {\n          nestedFormContainer = myFormLoader.loadForm(nestedForm.getFormFileName());\n        }\n        catch (Exception e) {\n          throw new CodeGenerationException(lwComponent.getId(), e.getMessage());\n        }\n        // if nested form is empty, ignore\n        if (nestedFormContainer.getComponentCount() == 0) {\n          return;\n        }\n        if (nestedFormContainer.getComponent(0).getBinding() == null) {\n          throw new CodeGenerationException(lwComponent.getId(), \"No binding on root component of nested form \" + nestedForm.getFormFileName());\n        }\n        try {\n          Utils.validateNestedFormLoop(nestedForm.getFormFileName(), myFormLoader);\n        }\n        catch (RecursiveFormNestingException e) {\n          throw new CodeGenerationException(lwComponent.getId(), \"Recursive form nesting is not allowed\");\n        }\n        className = myFormLoader.getClassToBindName(nestedFormContainer);\n      }\n      else {\n        className = getComponentCodeGenerator(lwComponent.getParent()).mapComponentClass(lwComponent.getComponentClassName());\n      }\n      Type componentType = typeFromClassName(className);\n      int componentLocal = generator.newLocal(componentType);\n\n      myIdToLocalMap.put(lwComponent.getId(), Integer.valueOf(componentLocal));\n\n      InstrumentationClassFinder.PseudoClass componentClass = getComponentClass(className, myFinder);","sourceCodeStart":392,"sourceCodeEnd":428,"githubUrl":"https://github.com/JetBrains/intellij-community/blob/be881553f2a76ac8b4ea53950d93f0de78295c19/java/compiler/forms-compiler/src/com/intellij/uiDesigner/compiler/AsmCodeGenerator.java#L392-L428","documentation":"When compiling a nested form, the code requires the nested form's first (root) component to have a field binding; if getComponent(0).getBinding() is null it throws CodeGenerationException('No binding on root component of nested form ...'). The generated code assigns the instantiated nested-form root to a field, so a binding is mandatory.","triggerScenarios":"A .form embedded via a nested-form component whose own root component has no 'field name' (binding) set in the GUI Designer.","commonSituations":"Author edited the nested form and cleared/renamed the root binding; nested form created by copying a panel form whose root was never bound; older forms migrated between designer versions losing root bindings.","solutions":["Open the nested form in the GUI Designer and set a binding (field name) on its root component","Alternatively edit the nested .form XML and add binding=\"fieldName\" to the first component element","Ensure the class bound to the form actually declares that field"],"exampleFix":"<!-- before: nested form root -->\n<component id=\"root\" class=\"javax.swing.JPanel\">\n\n<!-- after -->\n<component id=\"root\" class=\"javax.swing.JPanel\" binding=\"rootPanel\">","handlingStrategy":"validation","validationCode":"LwRootContainer nested = formLoader.loadForm(nestedForm.getFormFileName());\nif (nested.getComponentCount() > 0 && nested.getComponent(0).getBinding() == null) {\n  // fail with actionable message before bytecode generation\n}","typeGuard":null,"tryCatchPattern":"catch (CodeGenerationException e) if message contains 'No binding on root component': open the named nested .form and set a root binding, then rebuild","preventionTips":["Always set a field binding on the root component of forms intended for nesting","Add a designer/inspection check that nested forms have root bindings","After editing nested forms, verify the root binding survived the edit"],"tags":["gui-designer","forms","nested-forms","binding","intellij"],"backgroundTag":null,"analyzedSha":"be881553f2a76ac8b4ea53950d93f0de78295c19","analyzedAt":"2026-08-14T14:13:06.425Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}