JetBrains/intellij-community · warning · ConfigurationException
Nothing found to extract
Error message
Nothing found to extract
What it means
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.
Source
Thrown at java/java-impl-refactorings/src/com/intellij/refactoring/extractclass/ExtractClassDialog.java:178
isExtractAsEnum() ? enumConstants : Collections.emptyList(),
createInner.isSelected());
if (processor.getCreatedClass() == null) {
Messages.showErrorDialog(myVisibilityPanel, JavaRefactoringBundle.message("extract.delegate.unable.create.warning.message"));
classNameField.requestFocusInWindow();
return;
}
invokeRefactoring(processor);
}
@Override
protected void canRun() throws ConfigurationException {
final Project project = sourceClass.getProject();
final PsiNameHelper nameHelper = PsiNameHelper.getInstance(project);
final List<PsiMethod> methods = getMethodsToExtract();
final List<PsiField> fields = getFieldsToExtract();
final List<PsiClass> innerClasses = getClassesToExtract();
if (methods.isEmpty() && fields.isEmpty() && innerClasses.isEmpty()) {
throw new ConfigurationException(LangBundle.message("dialog.message.nothing.found.to.extract"));
}
final String className = getClassName();
if (className.isEmpty() || !nameHelper.isIdentifier(className)) {
throw new ConfigurationException(JavaBundle.message("invalid.extracted.class.name", className));
}
/*final String packageName = getPackageName();
if (packageName.length() == 0 || !nameHelper.isQualifiedName(packageName)) {
throw new ConfigurationException("\'" + packageName + "\' is invalid extracted class package name");
}*/
for (PsiClass innerClass : innerClasses) {
if (className.equals(innerClass.getName())) {
throw new ConfigurationException(
JavaBundle.message("extracted.class.should.have.unique.name", className));
}
}
}View on GitHub (pinned to be881553f2)
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).
Defensive patterns
Strategy: validation
Validate before calling
if (getMethodsToExtract().isEmpty() && getFieldsToExtract().isEmpty() && getClassesToExtract().isEmpty()) {
// disable OK / show hint: at least one member must be selected
} Try / catch
try { dialog.canRun(); } catch (ConfigurationException e) { /* nothing selected: check at least one member and retry */ } Prevention
- Preselect sensible defaults (e.g. fields to extract) when opening the dialog.
- Disable the OK button while the member table has no selection.
When it happens
Trigger: 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).
Common situations: 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.
Related errors
- ''{0}'' is invalid extracted class name
- Extracted class should have unique name. Name ''{0}'' is alr
- Invalid package name: {0}
- ''{0}'' is invalid field name for delegation
- ''{0}'' is invalid parameter name
AI-assisted analysis of JetBrains/intellij-community@be881553f2 (2026-08-14).
Data as JSON: /api/errors/35bdf66c57b9aa00.
Report an issue: GitHub.