{"record":{"id":"2bca4a55b5cdb44a","repo":"JetBrains/intellij-community","slug":"enter-a-module-name","errorCode":null,"errorMessage":"Enter a module name","messagePattern":"Enter a module name","errorType":"validation","errorClass":"ConfigurationException","httpStatus":null,"severity":"error","filePath":"java/idea-ui/src/com/intellij/ide/projectWizard/ModuleNameLocationComponent.java","lineNumber":358,"sourceCode":"      module = modifiableModel.findModuleByName(moduleName);\n    }\n    else {\n      module = ModuleManager.getInstance(project).findModuleByName(moduleName);\n    }\n    if (module != null) {\n      throw new ConfigurationException(\n        JavaUiBundle.message(\"module.name.location.dialog.message.module.already.exist.in.project\", moduleName));\n    }\n  }\n\n  private boolean validateModulePaths() throws ConfigurationException {\n    String moduleName = getModuleName();\n    String moduleFileDirectory = myModuleFileLocation.getText();\n    if (moduleFileDirectory.isEmpty()) {\n      throw new ConfigurationException(JavaUiBundle.message(\"module.name.location.dialog.message.enter.module.file.location\"));\n    }\n    if (moduleName.isEmpty()) {\n      throw new ConfigurationException(JavaUiBundle.message(\"module.name.location.dialog.message.enter.module.name\"));\n    }\n\n    if (!ProjectWizardUtil.createDirectoryIfNotExists(JavaUiBundle.message(\"directory.module.file\"), moduleFileDirectory,\n                                                      myImlLocationChangedByUser)) {\n      return false;\n    }\n    if (!ProjectWizardUtil.createDirectoryIfNotExists(JavaUiBundle.message(\"directory.module.content.root\"), myModuleContentRoot.getText(),\n                                                      myContentRootChangedByUser)) {\n      return false;\n    }\n\n    File moduleFile = new File(moduleFileDirectory, moduleName + ModuleFileType.DOT_DEFAULT_EXTENSION);\n    if (moduleFile.exists()) {\n      int answer = MessageDialogBuilder.yesNo(IdeBundle.message(\"title.file.already.exists\"),\n                                              CoreBundle.message(\"prompt.overwrite.project.file\", moduleFile.getAbsolutePath(),\n                                                                 IdeCoreBundle.message(\"project.new.wizard.module.identification\"))).show();\n      if (answer != Messages.YES) {\n        return false;","sourceCodeStart":340,"sourceCodeEnd":376,"githubUrl":"https://github.com/JetBrains/intellij-community/blob/be881553f2a76ac8b4ea53950d93f0de78295c19/java/idea-ui/src/com/intellij/ide/projectWizard/ModuleNameLocationComponent.java#L340-L376","documentation":"Thrown by ModuleNameLocationComponent.validateModulePaths() when the module name field is empty. A module cannot be created without a name (it is the key used by ModuleManager), so the wizard demands a name before proceeding.","triggerScenarios":"Calling validate()/validateModulePaths() when getModuleName() returns the empty string — the name field was cleared or a programmatic caller never set a name.","commonSituations":"User clears the auto-generated name in the New Module dialog; automation drives the wizard without seeding the name field; trailing-whitespace-only name passes a non-null check but fails the empty check after trimming.","solutions":["Enter a non-empty module name in the wizard's name field","In plugin code, always call setModuleName(uniqueName) before invoking validate()","Trim user input in custom wrappers so whitespace-only names are treated as empty early"],"exampleFix":"// before\ncomponent.setModuleFilePath(path);\n// name field empty\ncomponent.validate(); // ConfigurationException: Enter a module name\n\n// after\ncomponent.setModuleName(\"payment-service\");\ncomponent.setModuleFilePath(path + \"/payment-service/payment-service.iml\");\ncomponent.validate();","handlingStrategy":"validation","validationCode":"if (component.getModuleName() == null || component.getModuleName().trim().isEmpty()) {\n  // set a default name like 'untitledN' before calling validate()\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pre-fill a unique default module name whenever the step is shown","Treat whitespace-only input as empty in your own wrappers"],"tags":["module","wizard","validation","intellij"],"backgroundTag":null,"analyzedSha":"be881553f2a76ac8b4ea53950d93f0de78295c19","analyzedAt":"2026-08-14T14:13:06.425Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}