JetBrains/intellij-community · warning · ConfigurationException

type.migration.dialog.message.invalid.type

Error message

type.migration.dialog.message.invalid.type

What it means

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.

Source

Thrown at java/java-impl-refactorings/src/com/intellij/refactoring/typeMigration/ui/TypeMigrationDialog.java:218

          documentManager.commitDocument(document);
          validateButtons();
        }
      });
      init();
      validateButtons();
    }

    @Override
    protected void canRun() throws ConfigurationException {
      super.canRun();
      if (isIllegalVarargMigration()) {
        throw new ConfigurationException(JavaBundle.message("type.migration.dialog.message.vararg.type.not.applicable"));
      }
      if (isIllegalDisjunctionTypeMigration()) {
        throw new ConfigurationException(JavaBundle.message("type.migration.dialog.message.disjunction.type.not.applicable"));
      }
      if (isIllegalTypeMigration(getMigrationType())) {
        throw new ConfigurationException(
          JavaBundle.message("type.migration.dialog.message.invalid.type", StringUtil.escapeXmlEntities(myTypeCodeFragment.getText())));
      }
      if (isIllegalVoidMigration()) {
        throw new ConfigurationException(JavaBundle.message("type.migration.dialog.message.void.not.applicable"));
      }
      if (getMigrationType().equals(getRootType())) {
        throw new ConfigurationException(null);
      }
    }

    @Override
    public JComponent getPreferredFocusedComponent() {
      return myToTypeEditor;
    }

    @Override
    protected void appendMigrationTypeEditor(JPanel panel, GridBagConstraints gc) {
      final PsiType type = getRootType();

View on GitHub (pinned to be881553f2)

Solutions

  1. Fix the type text to a resolvable type — use code completion inside the type field to insert the correct FQN.
  2. Add the containing module/library to dependencies if the type lives elsewhere.
  3. Wait for indexing (or invalidate caches) if the class is new, then re-run.

Example fix

// before
// migrate to: com.acme.Utlis  (typo) -> isIllegalTypeMigration -> blocked

// after
// migrate to: com.acme.Utils
Defensive patterns

Strategy: validation

Validate before calling

String typeText = myTypeCodeFragment.getText();
PsiType resolved = JavaPsiFacade.getElementFactory(project)
    .createTypeFromText(typeText, null); // throws for unresolvable types
// or check the class directly:
// JavaPsiFacade.getInstance(project).findClass(fqn, GlobalSearchScope.allScope(project)) != null

Try / catch

try {
  PsiType t = JavaPsiFacade.getElementFactory(project).createTypeFromText(typeText, context);
} catch (IncorrectOperationException e) {
  // type text does not resolve; fix the FQN/dependencies before opening the migration dialog
}

Prevention

When it happens

Trigger: 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<'.

Common situations: 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.

Related errors


AI-assisted analysis of JetBrains/intellij-community@be881553f2 (2026-08-14). Data as JSON: /api/errors/e41e4ae82decf816. Report an issue: GitHub.