{"record":{"id":"0772d0dd9b77fcbf","repo":"JetBrains/intellij-community","slug":"the-project-is-already-registered","errorCode":null,"errorMessage":"The project is already registered","messagePattern":"The project is already registered","errorType":"validation","errorClass":"ConfigurationException","httpStatus":null,"severity":"error","filePath":"java/idea-ui/src/com/intellij/openapi/externalSystem/service/settings/AbstractImportFromExternalSystemControl.java","lineNumber":255,"sourceCode":"    return myShowProjectFormatPanel ? myProjectFormatPanel : null;\n  }\n\n  public boolean validate(WizardContext wizardContext, boolean defaultFormat) throws ConfigurationException {\n    if (ApplicationManager.getApplication().isHeadlessEnvironment()) return true;\n\n    if (!myProjectSettingsControl.validate(myProjectSettings)) return false;\n    if (mySystemSettingsControl != null && !mySystemSettingsControl.validate(mySystemSettings)) return false;\n    String linkedProjectPath = myLinkedProjectPathField.getPath();\n    Project currentProject = getProject();\n    if (StringUtil.isEmpty(linkedProjectPath)) {\n      throw new ConfigurationException(JavaUiBundle.message(\"error.project.undefined\"));\n    }\n    else if (currentProject != null) {\n      ExternalSystemManager<?, ?, ?, ?, ?> manager = ExternalSystemApiUtil.getManager(myExternalSystemId);\n      assert manager != null;\n      AbstractExternalSystemSettings<?, ?, ?> settings = manager.getSettingsProvider().fun(currentProject);\n      if (settings.getLinkedProjectSettings(linkedProjectPath) != null) {\n        throw new ConfigurationException(ExternalSystemBundle.message(\"error.project.already.registered\"));\n      }\n    }\n\n    return !(wizardContext.isCreatingNewProject() && !myLinkedProjectPathField.validateNameAndPath(wizardContext, defaultFormat));\n  }\n}\n","sourceCodeStart":237,"sourceCodeEnd":262,"githubUrl":"https://github.com/JetBrains/intellij-community/blob/be881553f2a76ac8b4ea53950d93f0de78295c19/java/idea-ui/src/com/intellij/openapi/externalSystem/service/settings/AbstractImportFromExternalSystemControl.java#L237-L262","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["If the project is already linked, use the Gradle/Maven tool window 'Reload' instead of the import wizard","Or remove the existing link first: Settings > Build Tools > Gradle/Maven, select the linked project, remove it, then re-import","Verify the path is not a duplicate alias (symlink/relative variant) of an already linked directory — canonicalize it"],"exampleFix":"// before\nString path = \"/home/user/demo\"; // already linked in Gradle settings\ncontrol.validate(wizardContext, true); // ConfigurationException: project is already registered\n\n// after\nAbstractExternalSystemSettings settings = GradleSettings.getInstance(project);\nsettings.unlinkExternalProject(path);\ncontrol.validate(wizardContext, true);","handlingStrategy":"validation","validationCode":"String path = control.getLinkedProjectPathField().getPath();\nif (project != null) {\n  ExternalSystemManager<?, ?, ?, ?, ?> manager = ExternalSystemApiUtil.getManager(systemId);\n  if (manager != null && manager.getSettingsProvider().fun(project).getLinkedProjectSettings(path) != null) {\n    // already linked: offer Reload from the tool window instead of import\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  control.validate(wizardContext, true);\n} catch (ConfigurationException e) {\n  // on 'already registered', unlink the stale entry and let the user retry once\n}","preventionTips":["Use the Gradle/Maven tool window Reload for projects that are already linked","Canonicalize linked paths (symlinks, trailing separators) before registering or comparing","Remove unused linked projects in Settings > Build Tools after restructuring"],"tags":["external-system","gradle","maven","duplicate","import","intellij"],"backgroundTag":null,"analyzedSha":"be881553f2a76ac8b4ea53950d93f0de78295c19","analyzedAt":"2026-08-14T14:13:06.425Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}