JetBrains/intellij-community · error · ConfigurationException

Enter a file name to create a new {0} {1}

Error message

Enter a file name to create a new {0} {1}

What it means

Thrown by NamePathComponent.validateNameAndPath() when the project/file name field is empty or whitespace-only. The wizard needs a name to derive the project file (.ipr) or directory name, so validation fails with a prompt naming the product and wizard presentation.

Source

Thrown at java/idea-ui/src/com/intellij/ide/util/projectWizard/NamePathComponent.java:152

      IdeBundle.message("label.project.files.location"),
      JavaUiBundle.message("title.select.project.file.directory", IdeCoreBundle.message("project.new.wizard.project.identification")),
      JavaUiBundle.message("description.select.project.file.directory", StringUtil.capitalize(IdeCoreBundle.message("project.new.wizard.project.identification"))),
      true, false
    );
    String baseDir = context.getProjectFileDirectory();
    String projectName = context.getProjectName();
    String initialProjectName = projectName != null ? projectName : ProjectWizardUtil.findNonExistingFileName(baseDir, "untitled", "");
    component.setPath(projectName == null ? (baseDir + File.separator + initialProjectName) : baseDir);
    component.setNameValue(initialProjectName);
    component.getNameComponent().select(0, initialProjectName.length());
    return component;
  }

  public boolean validateNameAndPath(WizardContext context, boolean defaultFormat) throws ConfigurationException {
    String name = getNameValue();
    if (StringUtil.isEmptyOrSpaces(name)) {
      ApplicationNamesInfo info = ApplicationNamesInfo.getInstance();
      throw new ConfigurationException(JavaUiBundle.message("prompt.new.project.file.name", info.getFullProductName(), context.getPresentationName()));
    }

    String projectDirectoryPath = getPath();
    if (StringUtil.isEmptyOrSpaces(projectDirectoryPath)) {
      throw new ConfigurationException(JavaUiBundle.message("prompt.enter.project.file.location", context.getPresentationName()));
    }
    if (myShouldBeAbsolute && !new File(projectDirectoryPath).isAbsolute()) {
      throw new ConfigurationException(JavaUiBundle.message("file.location.should.be.absolute", StringUtil.capitalize(context.getPresentationName())));
    }

    boolean shouldPromptCreation = isPathChangedByUser();
    String message = JavaUiBundle.message("directory.project.file.directory", context.getPresentationName());
    if (!ProjectWizardUtil.createDirectoryIfNotExists(message, projectDirectoryPath, shouldPromptCreation)) {
      return false;
    }

    File projectDirectory = new File(projectDirectoryPath);
    if (projectDirectory.exists() && !projectDirectory.canWrite()) {

View on GitHub (pinned to be881553f2)

Solutions

  1. Type a project/file name into the wizard's name field
  2. In plugin code, seed defaults: component.setNameValue(ProjectWizardUtil.findNonExistingFileName(baseDir, "untitled", ""))
  3. Disable Finish/guard the wizard until the name field is non-empty to give earlier feedback

Example fix

// before
component.setPath("/home/user/proj");
component.validateNameAndPath(context, true); // ConfigurationException: enter a file name

// after
component.setPath("/home/user/proj");
component.setNameValue("my-app");
component.validateNameAndPath(context, true);
Defensive patterns

Strategy: validation

Validate before calling

if (component.getNameValue() == null || component.getNameValue().trim().isEmpty()) {
  component.setNameValue(ProjectWizardUtil.findNonExistingFileName(baseDir, "untitled", ""));
}
component.validateNameAndPath(context, true);

Prevention

When it happens

Trigger: Calling validateNameAndPath(context, defaultFormat) while getNameValue() is empty — the name text component was never filled (StringUtil.isEmptyOrSpaces(name) is true).

Common situations: New Project wizard opened with cleared name; plugin embeds NamePathComponent and forgets setNameValue(); paste operation removed the default 'untitledN' name.

Related errors


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