{"record":{"id":"25d6152c0bd1c3b1","repo":"pentaho/pentaho-kettle","slug":"jobentrytruncatetables-unableloadrep","errorCode":null,"errorMessage":"JobEntryTruncateTables.UnableLoadRep","messagePattern":"JobEntryTruncateTables\\.UnableLoadRep","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/job/entries/truncatetables/JobEntryTruncateTables.java","lineNumber":162,"sourceCode":"\n  public void loadRep( Repository rep, IMetaStore metaStore, ObjectId id_jobentry, List<DatabaseMeta> databases,\n    List<SlaveServer> slaveServers ) throws KettleException {\n    try {\n      connection = rep.loadDatabaseMetaFromJobEntryAttribute( id_jobentry, \"connection\", \"id_database\", databases );\n\n      this.argFromPrevious = rep.getJobEntryAttributeBoolean( id_jobentry, \"arg_from_previous\" );\n      // How many arguments?\n      int argnr = rep.countNrJobEntryAttributes( id_jobentry, \"name\" );\n      allocate( argnr );\n\n      // Read them all...\n      for ( int a = 0; a < argnr; a++ ) {\n        this.arguments[a] = rep.getJobEntryAttributeString( id_jobentry, a, \"name\" );\n        this.schemaname[a] = rep.getJobEntryAttributeString( id_jobentry, a, \"schemaname\" );\n      }\n\n    } catch ( KettleDatabaseException dbe ) {\n      throw new KettleException( BaseMessages.getString( PKG, \"JobEntryTruncateTables.UnableLoadRep\", \"\"\n        + id_jobentry ), dbe );\n    }\n  }\n\n  public void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_job ) throws KettleException {\n    try {\n      rep.saveDatabaseMetaJobEntryAttribute( id_job, getObjectId(), \"connection\", \"id_database\", connection );\n\n      rep.saveJobEntryAttribute( id_job, getObjectId(), \"arg_from_previous\", this.argFromPrevious );\n      // save the arguments...\n      if ( this.arguments != null ) {\n        for ( int i = 0; i < this.arguments.length; i++ ) {\n          rep.saveJobEntryAttribute( id_job, getObjectId(), i, \"name\", this.arguments[i] );\n          rep.saveJobEntryAttribute( id_job, getObjectId(), i, \"schemaname\", this.schemaname[i] );\n        }\n      }\n    } catch ( KettleDatabaseException dbe ) {\n      throw new KettleException(","sourceCodeStart":144,"sourceCodeEnd":180,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/job/entries/truncatetables/JobEntryTruncateTables.java#L144-L180","documentation":"JobEntryTruncateTables.loadRep() wraps a KettleDatabaseException thrown while reading the job entry's 'name'/'schemaname' attributes from the repository into a KettleException with message 'JobEntryTruncateTables.UnableLoadRep' plus the id_jobentry. It signals that the stored repository rows for this job entry could not be read.","triggerScenarios":"Calling loadRep(rep, metaStore, id_jobentry, ...) against a repository whose database connection fails, whose R_JOBENTRY_ATTRIBUTE rows for id_jobentry are locked/corrupt, or whose schema is missing the expected attribute rows.","commonSituations":"Repository database down or networked DB unreachable; stale repository schema after a Pentaho upgrade; repository transaction left locked by a crashed client; corrupt id_jobentry referenced by a job.","solutions":["Verify the repository database is reachable and credentials in the repository connection are valid.","Inspect R_JOBENTRY_ATTRIBUTE rows for the reported id_jobentry and fix or delete corrupt rows.","Run the repository upgrade scripts matching your Pentaho version.","Re-save the job entry from Spoon to rebuild its repository attributes."],"exampleFix":"// before: job loaded against a stale/broken repository connection\nKettleEnvironment.init();\nRepository rep = new KettleDatabaseRepository();\nrep.connect(\"old_repo\", \"user\", \"pass\");\n// after: validate connection first and recreate repository metadata\nKettleEnvironment.init();\nRepositoriesMeta meta = new RepositoriesMeta();\nmeta.readData();\nRepository rep = meta.searchRepository(\"prod_repo\").getRepositoryElement();\nrep.connect(\"user\", \"pass\");","handlingStrategy":"try-catch","validationCode":"// Verify repository reachability and row presence before loadRep\nif ( !rep.isConnected() ) throw new KettleException(\"Repository not connected\");\n// optionally check attribute rows exist\nObjectId id = jobEntry.getObjectId();\nif ( id == null ) throw new KettleException(\"Job entry not persisted yet\");","typeGuard":"boolean canLoadFromRepository(Repository rep, ObjectId id) {\n  return rep != null && rep.isConnected() && id != null;\n}","tryCatchPattern":"try {\n  jobEntry.loadRep(rep, metaStore, id_jobentry, databases, slaveServers);\n} catch ( KettleException e ) {\n  logError(\"Repository load failed for id_jobentry=\" + id_jobentry + \": \" + e.getCause(), e);\n  throw e; // or fall back to XML load\n}","preventionTips":["Monitor repository database health before batch-loading jobs.","Apply repository schema upgrade scripts after Pentaho upgrades.","Re-save entries after manual DB maintenance on R_JOBENTRY_ATTRIBUTE.","Use the XML (.kjb) storage format when repository reliability is a concern."],"tags":["database","repository","kettle","persistence"],"backgroundTag":"database-query-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"}