{"record":{"id":"6fed6f0697c5332b","repo":"pentaho/pentaho-kettle","slug":"validationfailed-message-validation-failure-details-for","errorCode":null,"errorMessage":"ValidationFailed.Message (validation failure details for subject, one per line)","messagePattern":"ValidationFailed\\.Message \\(validation failure details for subject, one per line\\)","errorType":"validation","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/repository/RepositoryImporter.java","lineNumber":319,"sourceCode":"   * @param importRules\n   *          import rules to validate against.\n   * @param subject\n   * @throws KettleException\n   */\n  public static void validateImportedElement( ImportRules importRules, Object subject ) throws KettleException {\n    List<ImportValidationFeedback> feedback = importRules.verifyRules( subject );\n    List<ImportValidationFeedback> errors = ImportValidationFeedback.getErrors( feedback );\n    if ( !errors.isEmpty() ) {\n      StringBuilder message =\n          new StringBuilder( BaseMessages.getString( PKG, \"RepositoryImporter.ValidationFailed.Message\", subject\n              .toString() ) );\n      message.append( Const.CR );\n      for ( ImportValidationFeedback error : errors ) {\n        message.append( \" - \" );\n        message.append( error.toString() );\n        message.append( Const.CR );\n      }\n      throw new KettleException( message.toString() );\n    }\n  }\n\n  @Override\n  public void addLog( String line ) {\n    log.logBasic( line );\n  }\n\n  @Override\n  public void setLabel( String labelText ) {\n    log.logBasic( labelText );\n  }\n\n  @Override\n  public boolean transOverwritePrompt( TransMeta transMeta ) {\n    return overwrite;\n  }\n","sourceCodeStart":301,"sourceCodeEnd":337,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/repository/RepositoryImporter.java#L301-L337","documentation":"RepositoryImporter.validateImportedElement aggregates all ImportValidationFeedback errors for an imported element into a multi-line message and throws this KettleException when validation rules fail. It is the importer's gate that rejects transformations/jobs/databases that do not conform to the configured import rules (name conflicts, missing dependencies, rule violations).","triggerScenarios":"Calling loadSharedObjects, importTransformation, or importJob when an imported element violates an active ImportRuleInterface rule set — e.g. no rules executed errors, element name already exists in target folder, or a validation rule like 'transformation must have a description' fails.","commonSituations":"Bulk import where target repository already contains elements with the same names; importing shared objects (connections, etc.) that conflict with existing ones; importing without the validation rule set the original export assumed.","solutions":["Read the per-line feedback in the message — each '- ' line is one concrete validation failure; fix the first listed issue and re-run.","Adjust the import rules (ImportRuleSet) passed to the importer to permit the conflicting element, or enable the overwrite/rename option.","Rename or delete conflicting elements in the target repository before importing.","Set a validation listener / RulesController to skip failed elements instead of aborting the whole import."],"exampleFix":"// before: import fails on any validation rule violation\nimporter.validateImportedElement(transMeta, directory);\n\n// after: pre-check name conflicts and rename before import\nif (rep.exists(transMeta.getName(), directory)) {\n  transMeta.setName(transMeta.getName() + \"-imported\");\n}\nimporter.validateImportedElement(transMeta, directory);","handlingStrategy":"validation","validationCode":"// pre-check name conflicts in target folder\nboolean conflicts = rep.exists(element.getName(), directory);","typeGuard":null,"tryCatchPattern":"try {\n  importer.validateImportedElement(element, directory);\n} catch (KettleException e) {\n  // message has one ' - ' line per failed rule\n  List<String> failures = Arrays.stream(e.getMessage().split(\"\\n\"))\n      .filter(l -> l.startsWith(\" - \")).collect(Collectors.toList());\n  log.error(\"Validation failures: \" + failures);\n}","preventionTips":["Review the configured ImportRuleSet before bulk imports","Pre-check for name collisions in the target directory and rename ahead","Treat each ' - ' feedback line as a separate fixable issue","Run a dry-run import into a test repository first"],"tags":["kettle","import-validation","rules","repository"],"backgroundTag":"schema-validation-failed","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"}