{"record":{"id":"1f9e6c57f3a8ee38","repo":"JetBrains/intellij-community","slug":"move-classes-destination-class-not-found-message","errorCode":null,"errorMessage":"move.classes.destination.class.not.found.message","messagePattern":"move\\.classes\\.destination\\.class\\.not\\.found\\.message","errorType":"validation","errorClass":"ConfigurationException","httpStatus":null,"severity":"error","filePath":"java/java-impl-refactorings/src/com/intellij/refactoring/move/moveClassesOrPackages/MoveClassesOrPackagesDialog.java","lineNumber":556,"sourceCode":"      }\n    }\n  }\n\n  protected final boolean isSearchInComments() {\n    return myCbSearchInComments.isSelected();\n  }\n\n  @Override\n  protected void canRun() throws ConfigurationException {\n    if (isMoveToPackage()) {\n      String name = getTargetPackage().trim();\n      if (!name.isEmpty() && !PsiNameHelper.getInstance(myManager.getProject()).isQualifiedName(name)) {\n        throw new ConfigurationException(JavaBundle.message(\"move.classes.invalid.destination.package.name.message\", name));\n      }\n    }\n    else {\n      if (findTargetClass() == null) {\n        throw new ConfigurationException(\n          JavaBundle.message(\"move.classes.destination.class.not.found.message\"));\n      }\n      final String validationError = verifyInnerClassDestination();\n      if (validationError != null) throw new ConfigurationException(validationError);\n    }\n  }\n\n  @Override\n  protected void validateButtons() {\n    validateButtonsAsync(ModalityState.stateForComponent(myMainPanel));\n  }\n\n  private @Nullable PsiClass findTargetClass() {\n    String name = myInnerClassChooser.getText().trim();\n    return JavaPsiFacade.getInstance(myManager.getProject()).findClass(name, ProjectScope.getProjectScope(myProject));\n  }\n\n  protected boolean isMoveToPackage() {","sourceCodeStart":538,"sourceCodeEnd":574,"githubUrl":"https://github.com/JetBrains/intellij-community/blob/be881553f2a76ac8b4ea53950d93f0de78295c19/java/java-impl-refactorings/src/com/intellij/refactoring/move/moveClassesOrPackages/MoveClassesOrPackagesDialog.java#L538-L574","documentation":"Thrown by MoveClassesOrPackagesDialog.canRun() (MoveClassesOrPackagesDialog.java:556) when the move target is an inner class and findTargetClass() returns null — the typed/selected destination class cannot be resolved. The refactoring needs a concrete containing class to move members into; an unresolvable destination blocks it. Distinct from the package-name grammar check in the same method.","triggerScenarios":"Move (F6) with 'To inner class' semantics: the destination class field holds a qualified name that does not resolve in the project scope — wrong package, class in a non-dependent module, or a typo. Also fires when the field references a class deleted while the dialog was open.","commonSituations":"Moving utility methods into a class from another module not on the dependencies list; destination class renamed by a teammate mid-session; target exists only in test sources; index not yet updated after branch switch.","solutions":["Re-pick the destination class via the class browser (...) so the field holds a resolvable FQN.","Ensure the destination class's module/library is a dependency of the current module.","Let indexing finish or File | Invalidate Caches and restart, then retry the move.","If the class was renamed/deleted, choose the new destination explicitly."],"exampleFix":"// before\n// destination: com.acme.Utlis  (typo) -> findTargetClass() == null -> ConfigurationException\n\n// after\n// destination: com.acme.Utils   -> resolves, move proceeds","handlingStrategy":"validation","validationCode":"// before confirming a move-to-inner-class, ensure the destination resolves\nPsiClass target = findTargetClass(); // JavaPsiFacade.findClass(fqn, scope)\nif (target == null) {\n  // fix name/dependencies instead of letting canRun() throw\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pick destination classes from the chooser, not by typing.","Keep inter-module dependencies current when moving members across modules."],"tags":["intellij","refactoring","move","resolution","inner-class","classpath"],"backgroundTag":null,"analyzedSha":"be881553f2a76ac8b4ea53950d93f0de78295c19","analyzedAt":"2026-08-14T14:13:06.425Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}