{"record":{"id":"4c634c34848cee0c","repo":"pentaho/pentaho-kettle","slug":"tableexists-meta-unablesaverep","errorCode":null,"errorMessage":"TableExists.Meta.UnableSaveRep","messagePattern":"TableExists\\.Meta\\.UnableSaveRep","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/job/entries/tableexists/JobEntryTableExists.java","lineNumber":120,"sourceCode":"    try {\n      tablename = rep.getJobEntryAttributeString( id_jobentry, \"tablename\" );\n      schemaname = rep.getJobEntryAttributeString( id_jobentry, \"schemaname\" );\n\n      connection = rep.loadDatabaseMetaFromJobEntryAttribute( id_jobentry, \"connection\", \"id_database\", databases );\n    } catch ( KettleDatabaseException dbe ) {\n      throw new KettleException(\n        BaseMessages.getString( PKG, \"TableExists.Meta.UnableLoadRep\", \"\" + id_jobentry ), dbe );\n    }\n  }\n\n  public void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_job ) throws KettleException {\n    try {\n      rep.saveJobEntryAttribute( id_job, getObjectId(), \"tablename\", tablename );\n      rep.saveJobEntryAttribute( id_job, getObjectId(), \"schemaname\", schemaname );\n\n      rep.saveDatabaseMetaJobEntryAttribute( id_job, getObjectId(), \"connection\", \"id_database\", connection );\n    } catch ( KettleDatabaseException dbe ) {\n      throw new KettleException( BaseMessages.getString( PKG, \"TableExists.Meta.UnableSaveRep\", \"\" + id_job ), dbe );\n    }\n  }\n\n  public void setTablename( String tablename ) {\n    this.tablename = tablename;\n  }\n\n  public String getTablename() {\n    return tablename;\n  }\n\n  public String getSchemaname() {\n    return schemaname;\n  }\n\n  public void setSchemaname( String schemaname ) {\n    this.schemaname = schemaname;\n  }","sourceCodeStart":102,"sourceCodeEnd":138,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/job/entries/tableexists/JobEntryTableExists.java#L102-L138","documentation":"JobEntryTableExists.saveRep wraps any KettleDatabaseException thrown while persisting tablename, schemaname and the connection database meta into a KettleException with the localized 'TableExists.Meta.UnableSaveRep' message (id_job interpolated) and the original as cause. It means the entry's attributes could not be written to the repository.","triggerScenarios":"Calling saveRep when saveJobEntryAttribute or saveDatabaseMetaJobEntryAttribute throws: repository read-only, lost connection, invalid ObjectId, or constraint violation on the attribute columns.","commonSituations":"Repository user lacks write permission; saving concurrently from two Spoon sessions causing locks; database connection meta being saved references missing shared objects; disk/quota limits on the repository DB.","solutions":["Inspect the chained KettleDatabaseException cause for the exact SQL error","Verify the repository account has write privileges and is not in read-only mode","Ensure the job/entry ObjectIds are valid by saving the whole job via Spoon","Retry after confirming repository connectivity; check for table locks from stale sessions","Shorten tablename/schemaname values if a column-length limit is reported"],"exampleFix":"// before: entry detached from job, getObjectId() null\nrep.saveJobEntryAttribute(id_job, getObjectId(), \"tablename\", tablename); // throws\n// after: add the entry to the job and save the job so IDs are assigned\njob.addJobEntry(entry);\njob.saveRep(rep, metaStore, id_job);","handlingStrategy":"try-catch","validationCode":"// Java: preconditions before saveRep\nif (rep == null || !rep.isConnected() || getObjectId() == null) {\n  throw new KettleException(\"Repository unavailable or entry not persisted\");\n}","typeGuard":"if (id_job != null && getObjectId() != null) { /* safe to saveRep */ }","tryCatchPattern":"try {\n  entry.saveRep(rep, metaStore, id_job);\n} catch (KettleException e) {\n  logError(\"TableExists repo save failed: \" + e.getCause(), e);\n  // check permissions/locks, then retry once\n}","preventionTips":["Grant repository write access to the saving user","Save via Spoon so ObjectIds are valid","Watch for stale DB sessions holding locks on attribute tables","Keep tablename/schemaname within column length limits"],"tags":["pentaho-kettle","repository","database"],"backgroundTag":"database-write-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"}