{"record":{"id":"35bdf66c57b9aa00","repo":"JetBrains/intellij-community","slug":"nothing-found-to-extract","errorCode":null,"errorMessage":"Nothing found to extract","messagePattern":"Nothing found to extract","errorType":"validation","errorClass":"ConfigurationException","httpStatus":null,"severity":"warning","filePath":"java/java-impl-refactorings/src/com/intellij/refactoring/extractclass/ExtractClassDialog.java","lineNumber":178,"sourceCode":"                                                                      isExtractAsEnum() ? enumConstants : Collections.emptyList(),\n                                                                      createInner.isSelected());\n    if (processor.getCreatedClass() == null) {\n      Messages.showErrorDialog(myVisibilityPanel, JavaRefactoringBundle.message(\"extract.delegate.unable.create.warning.message\"));\n      classNameField.requestFocusInWindow();\n      return;\n    }\n    invokeRefactoring(processor);\n  }\n\n  @Override\n  protected void canRun() throws ConfigurationException {\n    final Project project = sourceClass.getProject();\n    final PsiNameHelper nameHelper = PsiNameHelper.getInstance(project);\n    final List<PsiMethod> methods = getMethodsToExtract();\n    final List<PsiField> fields = getFieldsToExtract();\n    final List<PsiClass> innerClasses = getClassesToExtract();\n    if (methods.isEmpty() && fields.isEmpty() && innerClasses.isEmpty()) {\n      throw new ConfigurationException(LangBundle.message(\"dialog.message.nothing.found.to.extract\"));\n    }\n\n    final String className = getClassName();\n    if (className.isEmpty() || !nameHelper.isIdentifier(className)) {\n      throw new ConfigurationException(JavaBundle.message(\"invalid.extracted.class.name\", className));\n    }\n\n    /*final String packageName = getPackageName();\n    if (packageName.length() == 0 || !nameHelper.isQualifiedName(packageName)) {\n      throw new ConfigurationException(\"\\'\" + packageName + \"\\' is invalid extracted class package name\");\n    }*/\n    for (PsiClass innerClass : innerClasses) {\n      if (className.equals(innerClass.getName())) {\n        throw new ConfigurationException(\n          JavaBundle.message(\"extracted.class.should.have.unique.name\", className));\n      }\n    }\n  }","sourceCodeStart":160,"sourceCodeEnd":196,"githubUrl":"https://github.com/JetBrains/intellij-community/blob/be881553f2a76ac8b4ea53950d93f0de78295c19/java/java-impl-refactorings/src/com/intellij/refactoring/extractclass/ExtractClassDialog.java#L160-L196","documentation":"ExtractClassDialog.canRun throws ConfigurationException (key dialog.message.nothing.found.to.extract from LangBundle) when the Extract Delegate/Extract Class dialog would run with no members selected: the lists of methods, fields, and inner classes to extract are all empty. The dialog validation prevents launching a refactoring that would create an empty new class.","triggerScenarios":"Opening Extract Class (or Extract Delegate on a class) and pressing OK/Run without ticking any checkbox in the members table, or with all members filtered out (e.g. all are inherited/static-initializer-only and not offered).","commonSituations":"Users hitting Enter expecting the dialog to preselect everything; member lists appearing empty because the class has only constructors or members not eligible for extraction; misunderstanding that at least one member must be chosen.","solutions":["Select at least one field, method, or inner class in the members table before running.","Use 'Select All'/checkbox shortcuts if you intend to move everything.","If the table is empty, verify you invoked Extract Class on a class that actually has extractable members (not an interface with no fields or a class whose members are all inherited)."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if (getMethodsToExtract().isEmpty() && getFieldsToExtract().isEmpty() && getClassesToExtract().isEmpty()) {\n  // disable OK / show hint: at least one member must be selected\n}","typeGuard":null,"tryCatchPattern":"try { dialog.canRun(); } catch (ConfigurationException e) { /* nothing selected: check at least one member and retry */ }","preventionTips":["Preselect sensible defaults (e.g. fields to extract) when opening the dialog.","Disable the OK button while the member table has no selection."],"tags":["java","intellij","refactoring","extract-class","dialog","validation","user-input"],"backgroundTag":null,"analyzedSha":"be881553f2a76ac8b4ea53950d93f0de78295c19","analyzedAt":"2026-08-14T14:13:06.425Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}