{"record":{"id":"e41e4ae82decf816","repo":"JetBrains/intellij-community","slug":"type-migration-dialog-message-invalid-type","errorCode":null,"errorMessage":"type.migration.dialog.message.invalid.type","messagePattern":"type\\.migration\\.dialog\\.message\\.invalid\\.type","errorType":"validation","errorClass":"ConfigurationException","httpStatus":null,"severity":"warning","filePath":"java/java-impl-refactorings/src/com/intellij/refactoring/typeMigration/ui/TypeMigrationDialog.java","lineNumber":218,"sourceCode":"          documentManager.commitDocument(document);\n          validateButtons();\n        }\n      });\n      init();\n      validateButtons();\n    }\n\n    @Override\n    protected void canRun() throws ConfigurationException {\n      super.canRun();\n      if (isIllegalVarargMigration()) {\n        throw new ConfigurationException(JavaBundle.message(\"type.migration.dialog.message.vararg.type.not.applicable\"));\n      }\n      if (isIllegalDisjunctionTypeMigration()) {\n        throw new ConfigurationException(JavaBundle.message(\"type.migration.dialog.message.disjunction.type.not.applicable\"));\n      }\n      if (isIllegalTypeMigration(getMigrationType())) {\n        throw new ConfigurationException(\n          JavaBundle.message(\"type.migration.dialog.message.invalid.type\", StringUtil.escapeXmlEntities(myTypeCodeFragment.getText())));\n      }\n      if (isIllegalVoidMigration()) {\n        throw new ConfigurationException(JavaBundle.message(\"type.migration.dialog.message.void.not.applicable\"));\n      }\n      if (getMigrationType().equals(getRootType())) {\n        throw new ConfigurationException(null);\n      }\n    }\n\n    @Override\n    public JComponent getPreferredFocusedComponent() {\n      return myToTypeEditor;\n    }\n\n    @Override\n    protected void appendMigrationTypeEditor(JPanel panel, GridBagConstraints gc) {\n      final PsiType type = getRootType();","sourceCodeStart":200,"sourceCodeEnd":236,"githubUrl":"https://github.com/JetBrains/intellij-community/blob/be881553f2a76ac8b4ea53950d93f0de78295c19/java/java-impl-refactorings/src/com/intellij/refactoring/typeMigration/ui/TypeMigrationDialog.java#L200-L236","documentation":"Thrown by TypeMigrationDialog.canRun() (TypeMigrationDialog.java:218) when isIllegalTypeMigration(getMigrationType()) is true — the text in the 'migrate to type' editor cannot be resolved to a valid type in the current context. The raw editor text is included in the message (XML-escaped) so the user sees exactly what failed to resolve.","triggerScenarios":"Refactoring | Type Migration with the To-type field containing a class that does not resolve: misspelled FQN, class from a module not on dependencies, missing import context, or syntactically broken generic text like 'List<'.","commonSituations":"Typing a simple name whose import is absent, referencing a class after a package rename, class lives in a library not yet indexed, or copy-pasting a type with generics that does not parse.","solutions":["Fix the type text to a resolvable type — use code completion inside the type field to insert the correct FQN.","Add the containing module/library to dependencies if the type lives elsewhere.","Wait for indexing (or invalidate caches) if the class is new, then re-run."],"exampleFix":"// before\n// migrate to: com.acme.Utlis  (typo) -> isIllegalTypeMigration -> blocked\n\n// after\n// migrate to: com.acme.Utils","handlingStrategy":"validation","validationCode":"String typeText = myTypeCodeFragment.getText();\nPsiType resolved = JavaPsiFacade.getElementFactory(project)\n    .createTypeFromText(typeText, null); // throws for unresolvable types\n// or check the class directly:\n// JavaPsiFacade.getInstance(project).findClass(fqn, GlobalSearchScope.allScope(project)) != null","typeGuard":null,"tryCatchPattern":"try {\n  PsiType t = JavaPsiFacade.getElementFactory(project).createTypeFromText(typeText, context);\n} catch (IncorrectOperationException e) {\n  // type text does not resolve; fix the FQN/dependencies before opening the migration dialog\n}","preventionTips":["Use code completion inside the type editor rather than pasting type names.","Ensure the target type's module is a dependency and indexes are up to date."],"tags":["intellij","refactoring","type-migration","java","resolution","validation"],"backgroundTag":null,"analyzedSha":"be881553f2a76ac8b4ea53950d93f0de78295c19","analyzedAt":"2026-08-14T14:13:06.425Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}