JetBrains/intellij-community · error · ConfigurationException

{0} location path should be absolute

Error message

{0} location path should be absolute

What it means

Thrown by NamePathComponent.validateNameAndPath() when the entered path is relative and the component requires absolute paths (myShouldBeAbsolute is true). Wizard-created projects must live at an unambiguous absolute location because the IDE stores and switches to it verbatim.

Source

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

    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()) {
      throw new ConfigurationException(JavaUiBundle.message("project.directory.is.not.writable", projectDirectoryPath));
    }
    for (Project p : ProjectManager.getInstance().getOpenProjects()) {
      if (ProjectUtil.isSameProject(projectDirectory.toPath(), p)) {
        throw new ConfigurationException(JavaUiBundle.message("project.directory.is.already.taken", projectDirectoryPath, p.getName()));
      }
    }
    if (projectDirectory.exists() && !projectDirectory.isDirectory()) {

View on GitHub (pinned to be881553f2)

Solutions

  1. Enter a fully qualified absolute path (e.g. /home/user/IdeaProjects/demo or C:\\work\\demo)
  2. Use the browse (...) button to pick the directory — it inserts an absolute path
  3. Replace '~' with the actual home directory path
  4. In plugin code, absolutize first: Path.of(baseDir, relative).toAbsolutePath().toString()

Example fix

// before
component.setPath("demo/app"); // relative
component.validateNameAndPath(context, true); // ConfigurationException: path should be absolute

// after
component.setPath(Path.of("/home/user/IdeaProjects/demo/app").toAbsolutePath().toString());
component.validateNameAndPath(context, true);
Defensive patterns

Strategy: validation

Validate before calling

String path = component.getPath();
if (path != null && !new File(path).isAbsolute()) {
  component.setPath(Path.of(baseDir, path).toAbsolutePath().toString());
}
component.validateNameAndPath(context, true);

Prevention

When it happens

Trigger: Calling validateNameAndPath() with getPath() returning something like 'mydir/proj' while myShouldBeAbsolute was enabled (default for this component); new File(path).isAbsolute() returns false on Unix for paths without a leading '/', or on Windows without a drive letter.

Common situations: User types a relative path such as '~/projects/x' that the field does not expand, or plain 'demo'; path variable/macro was not substituted; copy-paste from a shell-relative context.

Related errors


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