{"record":{"id":"07dd7bb87382c9f5","repo":"pentaho/pentaho-kettle","slug":"jobmeta-exception-anerroroccuredreadingjob-07dd7b","errorCode":null,"errorMessage":"JobMeta.Exception.AnErrorOccuredReadingJob","messagePattern":"JobMeta\\.Exception\\.AnErrorOccuredReadingJob","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/repository/kdr/delegates/KettleDatabaseRepositoryJobDelegate.java","lineNumber":507,"sourceCode":"          // Finally, clear the changed flags...\n          jobMeta.clearChanged();\n          if ( monitor != null ) {\n            monitor.subTask( BaseMessages.getString( PKG, \"JobMeta.Monitor.FinishedLoadOfJob\" ) );\n          }\n          if ( monitor != null ) {\n            monitor.done();\n          }\n\n          // close prepared statements, minimize locking etc.\n          //\n          repository.connectionDelegate.closeAttributeLookupPreparedStatements();\n\n          return jobMeta;\n        } else {\n          throw new KettleException( BaseMessages.getString( PKG, \"JobMeta.Exception.CanNotFindJob\" ) + jobname );\n        }\n      } catch ( KettleException dbe ) {\n        throw new KettleException( BaseMessages.getString(\n          PKG, \"JobMeta.Exception.AnErrorOccuredReadingJob\", jobname ), dbe );\n      } finally {\n        jobMeta.initializeVariablesFrom( jobMeta.getParentVariableSpace() );\n        jobMeta.setInternalKettleVariables();\n      }\n    }\n  }\n\n  /**\n   * Load the parameters of this job from the repository. The current ones already loaded will be erased.\n   *\n   * @param jobMeta\n   *          The target job for the parameters\n   *\n   * @throws KettleException\n   *           Upon any error.\n   *\n   */","sourceCodeStart":489,"sourceCodeEnd":525,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/repository/kdr/delegates/KettleDatabaseRepositoryJobDelegate.java#L489-L525","documentation":"Thrown by loadJobMeta as a wrapper around any KettleException (including KettleDatabaseException) that occurs while reading a job from the database repository. The localized message 'AnErrorOccuredReadingJob' plus job name wraps the real cause (dbe), so the root database error is in getCause(). This is the generic 'job read failed' guard of the loader.","triggerScenarios":"Calling repository.loadJobMeta(name, directory, monitor) when any DB access during loading fails: connection dropped mid-read, a SQL error in r_job/r_jobentry queries, or an exception thrown while hydrating job entries/hops.","commonSituations":"Network interruption during a large job load; incompatible repository schema versions (older client reading newer repository rows); locked tables or statement timeouts on the database; malformed data in job entry rows.","solutions":["Inspect the wrapped cause (e.getCause()) — fix the underlying KettleDatabaseException (connectivity, SQL, schema).","Verify the repository client and repository schema versions match (run upgrade scripts).","Reconnect to the repository and retry the load after transient DB failures.","Restore the job from another source (file backup) if the stored rows are corrupted."],"exampleFix":"// before: treating the wrapper message as the root cause\n} catch (KettleException e) {\n  log.error(e.getMessage());\n}\n\n// after: unwrap to surface the database error\n} catch (KettleException e) {\n  Throwable root = e;\n  while (root.getCause() != null) root = root.getCause();\n  log.error(\"Failed reading job: \" + e.getMessage(), root);\n}","handlingStrategy":"retry","validationCode":"// verify connection and name before attempting the load\nif (!repo.isConnected()) repo.connect();\nif (jobname == null || jobname.trim().isEmpty()) throw new IllegalArgumentException(\"jobname required\");\nif (directory == null || directory.getObjectId() == null) throw new IllegalArgumentException(\"directory must be loaded from repository\");","typeGuard":"boolean isLoadableRequest(String name, RepositoryDirectoryInterface dir) {\n  return name != null && !name.trim().isEmpty()\n      && dir != null && dir.getObjectId() != null;\n}","tryCatchPattern":"try {\n  jobMeta = repo.loadJobMeta(jobname, dir, monitor);\n} catch (KettleException e) {\n  if (rootCauseIsConnectionError(e)) {\n    repo.disconnect(); repo.connect();\n    jobMeta = repo.loadJobMeta(jobname, dir, monitor); // one retry\n  } else {\n    throw e; // schema/data problems are not retryable\n  }\n}","preventionTips":["Match client and repository schema versions; run upgrade scripts after Pentaho upgrades.","Retry once after reconnecting for transient DB/network failures, then fail fast.","Inspect e.getCause() — the wrapper message never tells the real problem.","Avoid loading very large jobs over unstable connections; prefer local file copies for heavy batch work."],"tags":["database","repository","job","read-failed"],"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"}