{"record":{"id":"2dca183cb417a380","repo":"pentaho/pentaho-kettle","slug":"error-while-exporting-repository-jobs","errorCode":null,"errorMessage":"Error while exporting repository jobs","messagePattern":"Error while exporting repository jobs","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/repository/RepositoryExporter.java","lineNumber":268,"sourceCode":"            monitor.registerRuleViolation();\n            writer.registerRuleViolation();\n          }\n          // do we need any feedback on this action?\n          if ( feedback ) {\n            ExportFeedback fb = new ExportFeedback();\n            fb.setType( ExportFeedback.Type.JOB );\n            fb.setItemName( jobMeta.getName() );\n            fb.setItemPath( dirPath );\n            ExportFeedback.Status status =\n                errors.isEmpty() ? ExportFeedback.Status.EXPORTED : ExportFeedback.Status.REJECTED;\n            fb.setStatus( status );\n            fb.setResult( errors );\n            this.feedbackList.add( fb );\n          }\n        }\n      }\n    } catch ( Exception e ) {\n      throw new KettleException( \"Error while exporting repository jobs\", e );\n    } finally {\n      writer.closeJob();\n    }\n  }\n\n  private void cancelMonitorAction( ExportWriter writer ) throws IOException {\n    // delete file\n    writer.registerRuleViolation();\n    // clear feedback list\n    if ( feedbackList != null ) {\n      feedbackList.clear();\n    }\n  }\n\n  private List<ImportValidationFeedback> validateObject( Object subject, boolean boolFeedback ) throws KettleException {\n    if ( !hasRules ) {\n      return Collections.emptyList();\n    }","sourceCodeStart":250,"sourceCodeEnd":286,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/repository/RepositoryExporter.java#L250-L286","documentation":"RepositoryExporter.exportJobs iterates repository directory tree exporting jobs to the ExportWriter. Any exception during job export (repository lookup, loading a job's metadata, XML generation) is wrapped in a KettleException \"Error while exporting repository jobs\"; the writer's closeJob() runs in finally. The original exception is preserved as the cause.","triggerScenarios":"Calling exportAllObjects/exportAllObjectsWithFeedback with jobs included when reading a job from the repository throws — e.g. loadRepositoryObject failure, corrupt job metadata in the repository database, or export XML serialization errors for a specific job.","commonSituations":"Repository database containing jobs referencing missing database connections or plugins; permission problems reading certain repository directories; network/DB connectivity drop mid-export; a single broken job aborting a whole-repository export.","solutions":["Inspect the cause chain to find the specific job/directory that failed; try exporting a narrower directory to isolate it.","Fix or remove the corrupt job entry in the repository database.","Verify repository DB connectivity and that all plugins referenced by the jobs are installed.","Check read permissions on the repository directories being exported.","Retry the export after resolving; partial output from the failed run should be discarded."],"exampleFix":"// before: whole-repo export aborts on one bad job\nexporter.exportAllObjects(monitor, \"all.xml\", null, RepositoryExportType.ALL);\n// after: narrow the scope to isolate the failing directory\ntry {\n  exporter.exportAllObjects(monitor, \"all.xml\", null, RepositoryExportType.ALL);\n} catch (KettleException e) {\n  log.error(\"Export failed; cause:\", e); // cause names the failing job\n  // re-run per directory via exportAllObjectsWithFeedback to skip the broken one\n}","handlingStrategy":"try-catch","validationCode":"// verify repository connectivity and plugin availability before export\nrepository.test();\nif (repository.connect(user, pass) == null) throw new IllegalStateException(\"Repository not connected\");","typeGuard":null,"tryCatchPattern":"try { exporter.exportAllObjects(monitor, file, null, RepositoryExportType.ALL); } catch (KettleException e) { Throwable cause = e; while (cause.getCause() != null) cause = cause.getCause(); log.error(\"Job export failed; root cause: \" + cause, e); }","preventionTips":["Test repository connection before large exports","Install all job-referenced plugins on the exporting instance","Export directory-by-directory to limit blast radius of a corrupt job","Maintain repository database health checks"],"tags":["export","repository","jobs","pdi"],"backgroundTag":"api-request-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"}