{"record":{"id":"8a45724a2f6248b5","repo":"pentaho/pentaho-kettle","slug":"unable-to-delete-object-with-id","errorCode":null,"errorMessage":"Unable to delete object with id [","messagePattern":"Unable to delete object with id \\[","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"plugins/pur/core/src/main/java/org/pentaho/di/repository/pur/PurRepository.java","lineNumber":868,"sourceCode":"    removeFromSharedObjectCache( RepositoryObjectType.CLUSTER_SCHEMA, idCluster );\n  }\n\n  @Override\n  public void deleteJob( ObjectId idJob ) throws KettleException {\n    deleteFileById( idJob );\n  }\n\n  protected void permanentlyDeleteSharedObject( final ObjectId id ) throws KettleException {\n    try {\n      readWriteLock.writeLock().lock();\n      try {\n        pur.deleteFile( id.getId(), true, null );\n      } finally {\n        readWriteLock.writeLock().unlock();\n      }\n\n    } catch ( Exception e ) {\n      throw new KettleException( \"Unable to delete object with id [\" + id + \"]\", e );\n    }\n  }\n\n  public void deleteFileById( final ObjectId id ) throws KettleException {\n    try {\n      readWriteLock.writeLock().lock();\n      try {\n        pur.deleteFile( id.getId(), null );\n      } finally {\n        readWriteLock.writeLock().unlock();\n      }\n\n      rootRef.clearRef();\n    } catch ( Exception e ) {\n      throw new KettleException( \"Unable to delete object with id [\" + id + \"]\", e );\n    }\n  }\n","sourceCodeStart":850,"sourceCodeEnd":886,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/pur/core/src/main/java/org/pentaho/di/repository/pur/PurRepository.java#L850-L886","documentation":"delecte flow: the repository attempted pur.deleteFile(id, true, null) to permanently delete a repository object and any exception was wrapped as this KettleException. It means the object with the given id could not be deleted in the PUR repository.","triggerScenarios":"Calling the delete API (deleteObject-like method at this site) with an ObjectId whose backing file cannot be deleted — missing file, insufficient permissions, referential locks, or PUR service error. The write lock is held during deletion.","commonSituations":"Deleting an object already removed by another user; lacking delete permission on the folder; server-side references (job/trans dependencies) preventing deletion; expired session.","solutions":["Confirm the object still exists before deleting; treat 'not found' as success in idempotent flows.","Check the caller's delete permissions on the containing folder.","Inspect e.getCause() for the server-side reason and resolve it (locks, references).","Retry after re-authenticating if the session expired."],"exampleFix":"// before\nrepo.deleteObject(id);\n// after\ntry {\n  repo.deleteObject(id);\n} catch (KettleException e) {\n  if (e.getCause() != null && String.valueOf(e.getCause()).contains(\"not found\")) {\n    log.info(\"Already deleted: {}\", id);\n  } else throw e;\n}","handlingStrategy":"try-catch","validationCode":"if (repo.getObjectId(id) == null) { log.info(\"Object {} already gone\", id); return; }","typeGuard":"null","tryCatchPattern":"try {\n  repo.deleteObject(id);\n} catch (KettleException e) {\n  log.error(\"Delete of {} failed: {}\", id, e.getCause(), e);\n  throw e;\n}","preventionTips":["Make deletes idempotent by treating not-found as success.","Verify delete permissions on the containing folder.","Avoid concurrent deletes from multiple clients."],"tags":["repository","delete","pentaho","persistence"],"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"}