JetBrains/intellij-community · error · ConfigurationException

Enter module file location

Error message

Enter module file location

What it means

Thrown by ModuleNameLocationComponent.validateModulePaths() when the module file location (the .iml directory) text field is empty. The wizard cannot decide where to place the module file, so validation stops with a prompt to enter the location.

Source

Thrown at java/idea-ui/src/com/intellij/ide/projectWizard/ModuleNameLocationComponent.java:355

      fromConfigurable != null ? fromConfigurable.getContext().getModulesConfigurator().getModuleModel()
                               : null;
    if (modifiableModel != null) {
      module = modifiableModel.findModuleByName(moduleName);
    }
    else {
      module = ModuleManager.getInstance(project).findModuleByName(moduleName);
    }
    if (module != null) {
      throw new ConfigurationException(
        JavaUiBundle.message("module.name.location.dialog.message.module.already.exist.in.project", moduleName));
    }
  }

  private boolean validateModulePaths() throws ConfigurationException {
    String moduleName = getModuleName();
    String moduleFileDirectory = myModuleFileLocation.getText();
    if (moduleFileDirectory.isEmpty()) {
      throw new ConfigurationException(JavaUiBundle.message("module.name.location.dialog.message.enter.module.file.location"));
    }
    if (moduleName.isEmpty()) {
      throw new ConfigurationException(JavaUiBundle.message("module.name.location.dialog.message.enter.module.name"));
    }

    if (!ProjectWizardUtil.createDirectoryIfNotExists(JavaUiBundle.message("directory.module.file"), moduleFileDirectory,
                                                      myImlLocationChangedByUser)) {
      return false;
    }
    if (!ProjectWizardUtil.createDirectoryIfNotExists(JavaUiBundle.message("directory.module.content.root"), myModuleContentRoot.getText(),
                                                      myContentRootChangedByUser)) {
      return false;
    }

    File moduleFile = new File(moduleFileDirectory, moduleName + ModuleFileType.DOT_DEFAULT_EXTENSION);
    if (moduleFile.exists()) {
      int answer = MessageDialogBuilder.yesNo(IdeBundle.message("title.file.already.exists"),
                                              CoreBundle.message("prompt.overwrite.project.file", moduleFile.getAbsolutePath(),

View on GitHub (pinned to be881553f2)

Solutions

  1. Fill in the module file location field with the directory where the .iml should live
  2. If the field is unexpectedly blank, close and reopen the wizard so defaults are recomputed
  3. In plugin code, always seed the component: component.setModuleFilePath(baseDir + "/" + name + "/" + name + ".iml") before validate()

Example fix

// before
component.setModuleName("my-module");
// module file location field left empty
component.validate(); // ConfigurationException: Enter module file location

// after
component.setModuleName("my-module");
component.setModuleFilePath(projectPath + "/my-module/my-module.iml");
component.validate();
Defensive patterns

Strategy: validation

Validate before calling

if (component.getModuleFileLocation() == null || component.getModuleFileLocation().getText().isEmpty()) {
  // prefill with project base dir + module name, then validate
}

Prevention

When it happens

Trigger: Calling validate()/validateModulePaths() while myModuleFileLocation.getText() returns the empty string — the user cleared the path field or the field was never pre-populated (e.g. headless use of the component without prior fill).

Common situations: User accidentally deletes the pre-filled module path in the New Module wizard; plugin reuses ModuleNameLocationComponent programmatically and forgets to call setModuleFileLocation; UI focus jumps straight to Finish.

Related errors


AI-assisted analysis of JetBrains/intellij-community@be881553f2 (2026-08-14). Data as JSON: /api/errors/b00f55b373e93d4c. Report an issue: GitHub.