{"record":{"id":"d72e2e6c6780f85a","repo":"JetBrains/intellij-community","slug":"no-external-project-config-file-is-defined","errorCode":null,"errorMessage":"No external project config file is defined","messagePattern":"No external project config file is defined","errorType":"validation","errorClass":"ConfigurationException","httpStatus":null,"severity":"error","filePath":"java/idea-ui/src/com/intellij/openapi/externalSystem/service/project/wizard/AbstractExternalProjectImportBuilder.java","lineNumber":285,"sourceCode":"\n  protected abstract void beforeCommit(@NotNull DataNode<ProjectData> dataNode, @NotNull Project project);\n\n  private @Nullable File getProjectFile() {\n    String path = getControl().getProjectSettings().getExternalProjectPath();\n    return path == null ? null : new File(path);\n  }\n\n  /**\n   * Asks current builder to ensure that target external project is defined.\n   *\n   * @param wizardContext             current wizard context\n   * @throws ConfigurationException   if external project is not defined and can't be constructed\n   */\n  public void ensureProjectIsDefined(@NotNull WizardContext wizardContext) throws ConfigurationException {\n    final String externalSystemName = myExternalSystemId.getReadableName();\n    File projectFile = getProjectFile();\n    if (projectFile == null) {\n      throw new ConfigurationException(JavaUiBundle.message(\"error.project.undefined\"));\n    }\n    projectFile = getExternalProjectConfigToUse(projectFile);\n    final Ref<ConfigurationException> error = new Ref<>();\n    final ExternalProjectRefreshCallback callback = new ExternalProjectRefreshCallback() {\n      @Override\n      public void onSuccess(@Nullable DataNode<ProjectData> externalProject) {\n        myExternalProjectNode = externalProject;\n      }\n\n      @Override\n      public void onFailure(@NotNull String errorMessage, @Nullable String errorDetails) {\n        if (!StringUtil.isEmpty(errorDetails)) {\n          LOG.warn(errorDetails);\n        }\n        error.set(new ConfigurationException(\n          JavaUiBundle.message(\"error.resolve.with.log_link\", errorMessage, PathManager.getLogPath()),\n          JavaUiBundle.message(\"error.resolve.generic\")));\n      }","sourceCodeStart":267,"sourceCodeEnd":303,"githubUrl":"https://github.com/JetBrains/intellij-community/blob/be881553f2a76ac8b4ea53950d93f0de78295c19/java/idea-ui/src/com/intellij/openapi/externalSystem/service/project/wizard/AbstractExternalProjectImportBuilder.java#L267-L303","documentation":"Thrown by AbstractExternalProjectImportBuilder.ensureProjectIsDefined() when getProjectFile() returns null — the import builder has no external project config file (build.gradle, pom.xml equivalent, etc.) to refresh. Before linking/previewing, the builder must resolve the external model from a config file, and with none defined it cannot proceed.","triggerScenarios":"Wizard flow calling ensureProjectIsDefined(wizardContext) after the linked-project path was never set (setProjectFile not called, or the path field cleared) — getProjectFile() yields null and ConfigurationException('error.project.undefined') is thrown.","commonSituations":"Import-from-Gradle/Maven wizard advanced with an empty location field; subclass of AbstractExternalProjectImportBuilder forgets to store the file when the path control changes; headless import where the path was not plumbed through.","solutions":["Enter/select the external project location (the directory or build script) in the wizard before finishing","In subclass code, implement/propagate setProjectFile so getProjectFile() returns the chosen config after the path step","Guard: if (builder.getProjectFile() == null) keep user on the path step instead of calling ensureProjectIsDefined"],"exampleFix":"// before\n// user left 'Gradle project' path empty, then Finish\nbuilder.ensureProjectIsDefined(context); // ConfigurationException: no external project config file\n\n// after\nbuilder.setProjectFile(new File(\"/home/user/demo/build.gradle\"));\nbuilder.ensureProjectIsDefined(context);","handlingStrategy":"validation","validationCode":"if (builder.getProjectFile() == null) {\n  // keep the user on the path step; do not call ensureProjectIsDefined yet\n  return;\n}\nbuilder.ensureProjectIsDefined(context);","typeGuard":null,"tryCatchPattern":"try {\n  builder.ensureProjectIsDefined(context);\n} catch (ConfigurationException e) {\n  // route back to the external-project path step instead of failing the wizard\n}","preventionTips":["Implement setProjectFile in the builder so the wizard context always carries the chosen config","Update the stored file on every path-field change, not only at Finish"],"tags":["external-system","import","wizard","gradle","maven","intellij"],"backgroundTag":null,"analyzedSha":"be881553f2a76ac8b4ea53950d93f0de78295c19","analyzedAt":"2026-08-14T14:13:06.425Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}