JetBrains/intellij-community · error · ConfigurationException

The project is already registered

Error message

The project is already registered

What it means

Thrown by AbstractImportFromExternalSystemControl.validate() when the entered linked project path is already registered in the current project's external system settings (settings.getLinkedProjectSettings(linkedProjectPath) != null). Linking the same external project twice would duplicate its modules and dependencies, so the control rejects it.

Source

Thrown at java/idea-ui/src/com/intellij/openapi/externalSystem/service/settings/AbstractImportFromExternalSystemControl.java:255

    return myShowProjectFormatPanel ? myProjectFormatPanel : null;
  }

  public boolean validate(WizardContext wizardContext, boolean defaultFormat) throws ConfigurationException {
    if (ApplicationManager.getApplication().isHeadlessEnvironment()) return true;

    if (!myProjectSettingsControl.validate(myProjectSettings)) return false;
    if (mySystemSettingsControl != null && !mySystemSettingsControl.validate(mySystemSettings)) return false;
    String linkedProjectPath = myLinkedProjectPathField.getPath();
    Project currentProject = getProject();
    if (StringUtil.isEmpty(linkedProjectPath)) {
      throw new ConfigurationException(JavaUiBundle.message("error.project.undefined"));
    }
    else if (currentProject != null) {
      ExternalSystemManager<?, ?, ?, ?, ?> manager = ExternalSystemApiUtil.getManager(myExternalSystemId);
      assert manager != null;
      AbstractExternalSystemSettings<?, ?, ?> settings = manager.getSettingsProvider().fun(currentProject);
      if (settings.getLinkedProjectSettings(linkedProjectPath) != null) {
        throw new ConfigurationException(ExternalSystemBundle.message("error.project.already.registered"));
      }
    }

    return !(wizardContext.isCreatingNewProject() && !myLinkedProjectPathField.validateNameAndPath(wizardContext, defaultFormat));
  }
}

View on GitHub (pinned to be881553f2)

Solutions

  1. If the project is already linked, use the Gradle/Maven tool window 'Reload' instead of the import wizard
  2. Or remove the existing link first: Settings > Build Tools > Gradle/Maven, select the linked project, remove it, then re-import
  3. Verify the path is not a duplicate alias (symlink/relative variant) of an already linked directory — canonicalize it

Example fix

// before
String path = "/home/user/demo"; // already linked in Gradle settings
control.validate(wizardContext, true); // ConfigurationException: project is already registered

// after
AbstractExternalSystemSettings settings = GradleSettings.getInstance(project);
settings.unlinkExternalProject(path);
control.validate(wizardContext, true);
Defensive patterns

Strategy: validation

Validate before calling

String path = control.getLinkedProjectPathField().getPath();
if (project != null) {
  ExternalSystemManager<?, ?, ?, ?, ?> manager = ExternalSystemApiUtil.getManager(systemId);
  if (manager != null && manager.getSettingsProvider().fun(project).getLinkedProjectSettings(path) != null) {
    // already linked: offer Reload from the tool window instead of import
  }
}

Try / catch

try {
  control.validate(wizardContext, true);
} catch (ConfigurationException e) {
  // on 'already registered', unlink the stale entry and let the user retry once
}

Prevention

When it happens

Trigger: Calling validate() inside an open project (getProject() != null) while linkedProjectPath matches an existing linked project path in AbstractExternalSystemSettings for that external system — e.g. running import/link wizard again for the same Gradle/Maven project.

Common situations: User runs 'Import Module from Gradle' for a project already linked in settings; two teams' builds sharing the same path via symlink; re-import attempted through the wizard instead of the Gradle/Maven tool window refresh; unlinked earlier attempt left the registration behind.

Related errors


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