{"record":{"id":"eb5989f3fa706b21","repo":"pentaho/pentaho-kettle","slug":"file-is-in-the-trash-use-save-as","errorCode":null,"errorMessage":"File is in the Trash. Use Save As.","messagePattern":"File is in the Trash\\. Use Save As\\.","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"plugins/pur/core/src/main/java/org/pentaho/di/repository/pur/PurRepository.java","lineNumber":3461,"sourceCode":"    }\n\n    ExtensionPointHandler.callExtensionPoint( log, KettleExtensionPoint.BeforeSaveToRepository.id, element );\n\n    final boolean isUpdate = ( element.getObjectId() != null && element.getObjectId().getId() != null  );\n    RepositoryFile file = null;\n    if ( isUpdate ) {\n\n      readWriteLock.readLock().lock();\n      try {\n        ObjectId id = element.getObjectId();\n        file = pur.getFileById( id.getId() );\n\n        if ( checkLock && file.isLocked() && !unifiedRepositoryLockService.canUnlockFileById( id ) ) {\n          throw new KettleException( \"File is currently locked by another user for editing\" );\n        }\n        if ( checkDeleted && isInTrash( file ) ) {\n          // absolutely awful to have UI references in this class :(\n          throw new KettleException( \"File is in the Trash. Use Save As.\" );\n        }\n      } finally {\n        readWriteLock.readLock().unlock();\n      }\n\n      readWriteLock.writeLock().lock();\n      try {\n        // update title and description\n        file =\n          new RepositoryFile.Builder( file ).title( RepositoryFile.DEFAULT_LOCALE, element.getName() ).createdDate(\n            versionDate != null ? versionDate.getTime() : new Date() ).description( RepositoryFile.DEFAULT_LOCALE,\n            Const.NVL( element.getDescription(), \"\" ) ).build();\n\n        file =\n          pur.updateFile( file, new NodeRepositoryFileData( objectTransformer.elementToDataNode( element ) ),\n            versionComment );\n      } catch ( SOAPFaultException e ) {\n        if ( e.getMessage().contains( UnifiedRepositoryUpdateFileException.PREFIX ) ) {","sourceCodeStart":3443,"sourceCodeEnd":3479,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/pur/core/src/main/java/org/pentaho/di/repository/pur/PurRepository.java#L3443-L3479","documentation":"Before saving, PurRepository checks (when checkDeleted is enabled) whether the target file currently lives in the repository Trash. A deleted file cannot be updated in place, so the save is aborted and the developer is told to use Save As. The message deliberately references UI behavior.","triggerScenarios":"Calling PurRepository.save on a file whose ObjectId resolves to a file in the trash (isInTrash(file) is true) — e.g. saving a transformation that was deleted in the repository browser before the save.","commonSituations":"Long-running Spoon session where a colleague deleted the transformation mid-edit; saving after accidentally deleting the file; scripts holding stale ObjectIds to deleted files.","solutions":["Use 'Save As' to save the element to a new file/path","Restore the file from the repository Trash, then retry the save","Re-create the file at the original location and then save over it"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"RepositoryFile f = pur.getFileById(element.getObjectId().getId());\nif (f == null || (f.isDeleted() != null && f.isDeleted())) {\n  throw new KettleException(\"File no longer exists (in trash). Use Save As.\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  repository.save(element, comment, null, true);\n} catch (KettleException e) {\n  if (e.getMessage() != null && e.getMessage().contains(\"Trash\")) {\n    // prompt user for Save As with a new name/path\n  } else throw e;\n}","preventionTips":["Re-fetch the file by ID before saving a long-lived reference","Avoid keeping stale ObjectIds across long editing sessions","If the file was deleted, restore from trash or save under a new name"],"tags":["kettle","pentaho","repository","trash","stale-reference"],"backgroundTag":"file-not-found","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"}