pentaho/pentaho-kettle · error · RuntimeException

RepositoryImporter.CannotPrompt.Label

Error message

RepositoryImporter.CannotPrompt.Label

What it means

RepositoryImporter.overwritePrompt sets up an OverwritePrompter. When the feedback object provided does not implement HasOverwritePrompter, the importer installs a stub prompter whose overwritePrompt always throws RuntimeException with message RepositoryImporter.CannotPrompt.Label ("Cannot prompt for overwrite"). It fires when the importer must ask the user whether to overwrite an existing object but no interactive prompter was supplied.

Solutions

  1. Supply a feedback object implementing HasOverwritePrompter whose getOverwritePrompter() returns a real (or auto-approving/denying) OverwritePrompter.
  2. For headless runs, pass a prompter that consistently returns true (overwrite all) or false (skip) instead of asking.
  3. Alternatively enable 'replace existing objects' behavior so the prompt path is never reached.
  4. Pre-clean or rename conflicting objects in the repository so no overwrite prompt is needed.

Example fix

// before: plain feedback without a prompter => RuntimeException on conflict
importer.importAll(repositoryDirectory, filenames, false, null, false, false, feedback /* no HasOverwritePrompter */);
// after: provide an auto-yes overwrite prompter
OverwritePrompter p = (message, a, b) -> true;
HasOverwritePrompter promptableFeedback = new HasOverwritePrompter() {
  public OverwritePrompter getOverwritePrompter() { return p; }
};
importer.importAll(repositoryDirectory, filenames, false, null, false, false, promptableFeedback);
Defensive patterns

Strategy: type-guard

Validate before calling

if (!(feedback instanceof HasOverwritePrompter) && mayOverwrite) {
  throw new IllegalArgumentException("Headless import requires a HasOverwritePrompter feedback object");
}

Type guard

static boolean canPrompt(Object feedback) { return feedback instanceof HasOverwritePrompter; }

Try / catch

try { importer.importAll(dir, files, false, null, false, false, feedback); } catch (RuntimeException e) { if (e.getMessage().contains("CannotPrompt")) { log.error("Import conflicts need an OverwritePrompter; supply one or enable replace-existing"); } throw e; }

Prevention

When it happens

Trigger: Running a repository import (non-interactive) where the supplied feedback/observer object is not an instance of HasOverwritePrompter, and the import encounters an existing object it would overwrite, triggering overwritePrompt(...).

Common situations: Headless/kitchen imports with no UI prompter configured while the imported content collides with existing transformations/jobs; passing a plain IProgressMonitor instead of a prompter-capable feedback object; automated pipelines importing into a repository that already contains the same-named objects.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13). Data as JSON: /api/errors/83a9c68d66366a39. Report an issue: GitHub.

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/repository/RepositoryImporter.java:187

    String importPathCompatibility =
        System.getProperty( Const.KETTLE_COMPATIBILITY_IMPORT_PATH_ADDITION_ON_VARIABLES, "N" );
    this.needToCheckPathForVariables = "N".equalsIgnoreCase( importPathCompatibility );

    askReplace = Props.getInstance().askAboutReplacingDatabaseConnections();

    if ( askReplace ) {
      if ( feedback instanceof HasOverwritePrompter ) {
        Props.getInstance().setProperty( IMPORT_ASK_ABOUT_REPLACE_CS, "Y" );
        Props.getInstance().setProperty( IMPORT_ASK_ABOUT_REPLACE_DB, "Y" );
        Props.getInstance().setProperty( IMPORT_ASK_ABOUT_REPLACE_PS, "Y" );
        Props.getInstance().setProperty( IMPORT_ASK_ABOUT_REPLACE_SS, "Y" );
        this.overwritePrompter = ( (HasOverwritePrompter) feedback ).getOverwritePrompter();
      } else {
        this.overwritePrompter = new OverwritePrompter() {

          @Override
          public boolean overwritePrompt( String arg0, String arg1, String arg2 ) {
            throw new RuntimeException( BaseMessages.getString( PKG, "RepositoryImporter.CannotPrompt.Label" ) );
          }
        };
      }
    } else {
      final boolean replaceExisting = Props.getInstance().replaceExistingDatabaseConnections();
      this.overwritePrompter = new OverwritePrompter() {

        @Override
        public boolean overwritePrompt( String arg0, String arg1, String arg2 ) {
          return replaceExisting;
        }
      };
    }

    referencingObjects = new ArrayList<RepositoryObject>();

    feedback.setLabel( BaseMessages.getString( PKG, "RepositoryImporter.ImportXML.Label" ) );
    try {

View on GitHub (pinned to f3058517a1)