{"record":{"id":"83a9c68d66366a39","repo":"pentaho/pentaho-kettle","slug":"repositoryimporter-cannotprompt-label","errorCode":null,"errorMessage":"RepositoryImporter.CannotPrompt.Label","messagePattern":"RepositoryImporter\\.CannotPrompt\\.Label","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/repository/RepositoryImporter.java","lineNumber":187,"sourceCode":"    String importPathCompatibility =\n        System.getProperty( Const.KETTLE_COMPATIBILITY_IMPORT_PATH_ADDITION_ON_VARIABLES, \"N\" );\n    this.needToCheckPathForVariables = \"N\".equalsIgnoreCase( importPathCompatibility );\n\n    askReplace = Props.getInstance().askAboutReplacingDatabaseConnections();\n\n    if ( askReplace ) {\n      if ( feedback instanceof HasOverwritePrompter ) {\n        Props.getInstance().setProperty( IMPORT_ASK_ABOUT_REPLACE_CS, \"Y\" );\n        Props.getInstance().setProperty( IMPORT_ASK_ABOUT_REPLACE_DB, \"Y\" );\n        Props.getInstance().setProperty( IMPORT_ASK_ABOUT_REPLACE_PS, \"Y\" );\n        Props.getInstance().setProperty( IMPORT_ASK_ABOUT_REPLACE_SS, \"Y\" );\n        this.overwritePrompter = ( (HasOverwritePrompter) feedback ).getOverwritePrompter();\n      } else {\n        this.overwritePrompter = new OverwritePrompter() {\n\n          @Override\n          public boolean overwritePrompt( String arg0, String arg1, String arg2 ) {\n            throw new RuntimeException( BaseMessages.getString( PKG, \"RepositoryImporter.CannotPrompt.Label\" ) );\n          }\n        };\n      }\n    } else {\n      final boolean replaceExisting = Props.getInstance().replaceExistingDatabaseConnections();\n      this.overwritePrompter = new OverwritePrompter() {\n\n        @Override\n        public boolean overwritePrompt( String arg0, String arg1, String arg2 ) {\n          return replaceExisting;\n        }\n      };\n    }\n\n    referencingObjects = new ArrayList<RepositoryObject>();\n\n    feedback.setLabel( BaseMessages.getString( PKG, \"RepositoryImporter.ImportXML.Label\" ) );\n    try {","sourceCodeStart":169,"sourceCodeEnd":205,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/repository/RepositoryImporter.java#L169-L205","documentation":"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.","triggerScenarios":"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(...).","commonSituations":"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.","solutions":["Supply a feedback object implementing HasOverwritePrompter whose getOverwritePrompter() returns a real (or auto-approving/denying) OverwritePrompter.","For headless runs, pass a prompter that consistently returns true (overwrite all) or false (skip) instead of asking.","Alternatively enable 'replace existing objects' behavior so the prompt path is never reached.","Pre-clean or rename conflicting objects in the repository so no overwrite prompt is needed."],"exampleFix":"// before: plain feedback without a prompter => RuntimeException on conflict\nimporter.importAll(repositoryDirectory, filenames, false, null, false, false, feedback /* no HasOverwritePrompter */);\n// after: provide an auto-yes overwrite prompter\nOverwritePrompter p = (message, a, b) -> true;\nHasOverwritePrompter promptableFeedback = new HasOverwritePrompter() {\n  public OverwritePrompter getOverwritePrompter() { return p; }\n};\nimporter.importAll(repositoryDirectory, filenames, false, null, false, false, promptableFeedback);","handlingStrategy":"type-guard","validationCode":"if (!(feedback instanceof HasOverwritePrompter) && mayOverwrite) {\n  throw new IllegalArgumentException(\"Headless import requires a HasOverwritePrompter feedback object\");\n}","typeGuard":"static boolean canPrompt(Object feedback) { return feedback instanceof HasOverwritePrompter; }","tryCatchPattern":"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; }","preventionTips":["Always pass a HasOverwritePrompter feedback for unattended imports","Decide overwrite policy up front (auto-yes / auto-no)","Enable 'replace existing objects' when re-importing known content","Pre-check name collisions before running the import"],"tags":["import","interactive-prompt","headless","pdi"],"backgroundTag":"unsupported-operation","analyzedSha":"f3058517a153da500bf4551f46d79b91bf8ec552","analyzedAt":"2026-09-13T14:04:16.340Z","contentChangedAt":"2026-09-13T14:04:16.340Z","schemaVersion":2},"datasetVersion":"2026-09-20T23:17:15.980Z"}