JetBrains/intellij-community · error · ConfigurationException
Directory ' ' is already taken by the project ' '. Please…
Error message
Directory '{0}' is already taken by the project '{1}'. Please choose another location. What it means
Thrown by NamePathComponent.validateNameAndPath() when the chosen directory is already the home of an open project (ProjectUtil.isSameProject matches it against every project in ProjectManager.getOpenProjects()). Two open IDE projects cannot share one directory — their .idea stores would collide — so the wizard blocks it and names the occupying project.
Solutions
- Close the existing project (the one named in the message) in its IDE window, then retry
- Or point the wizard at a different, unused directory
- If you only wanted to reopen it, use File > Open on the existing directory instead of New Project
Defensive patterns
Strategy: validation
Validate before calling
Path target = Path.of(component.getPath());
for (Project open : ProjectManager.getInstance().getOpenProjects()) {
if (ProjectUtil.isSameProject(target, open)) {
// tell user to close project 'open.getName()' or choose another dir
}
} Prevention
- Before New Project, check whether the target directory is already open and just File > Open it
- Canonicalize paths when comparing candidate directories to avoid symlink blind spots
When it happens
Trigger: Calling validateNameAndPath() with a projectDirectory path that isSameProject() considers equal to an already open project's base path (same canonical path, or the directory containing that project's .idea).
Common situations: Creating a 'new' project in a directory that is already open in another IDE window or the same one; symlinks/case differences resolving to the same canonical path; re-running a wizard against a checked-out project that is currently open.
Related errors
- location path should be absolute
- Directory ' ' doesn't seem to be writeable. Please choose…
- Enter file location
- Enter file location
- Enter a file name to create a new
AI-assisted analysis of JetBrains/intellij-community@be881553f2 (2026-08-14).
Data as JSON: /api/errors/b4cb58fcccabe30a.
Report an issue: GitHub.
Appendix: source
Thrown at java/idea-ui/src/com/intellij/ide/util/projectWizard/NamePathComponent.java:175
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()) {
LOG.warn(String.format("Project '%s' directory should be a directory", projectDirectoryPath));
}
boolean shouldContinue = true;
if (!ApplicationManager.getApplication().isUnitTestMode()) {
String fileName = defaultFormat ? name + ProjectFileType.DOT_DEFAULT_EXTENSION : Project.DIRECTORY_STORE_FOLDER;
File projectFile = new File(projectDirectory, fileName);
if (projectFile.exists()) {
message = CoreBundle.message("prompt.overwrite.project.file", projectFile.getAbsolutePath(), context.getPresentationName());
shouldContinue = MessageDialogBuilder.yesNo(IdeBundle.message("title.file.already.exists"), message).show() == Messages.YES;
}
}
return shouldContinue;
}
public String getNameValue() {View on GitHub (pinned to be881553f2)