{"record":{"id":"92648bb6c2ae68f4","repo":"pentaho/pentaho-kettle","slug":"file-is-currently-locked-by-another-user-for-editing","errorCode":null,"errorMessage":"File is currently locked by another user for editing","messagePattern":"File is currently locked by another user for editing","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"plugins/pur/core/src/main/java/org/pentaho/di/repository/pur/PurRepository.java","lineNumber":3457,"sourceCode":"    if ( Import.ROOT_DIRECTORY.equals( element.getRepositoryDirectory().toString() ) ) {\n      // We don't have possibility to read this file via UI\n      throw new KettleException( BaseMessages.getString( PKG, \"PurRepository.fileCannotBeSavedInRootDirectory\",\n        element.getName() + element.getRepositoryElementType().getExtension() ) );\n    }\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 =","sourceCodeStart":3439,"sourceCodeEnd":3475,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/pur/core/src/main/java/org/pentaho/di/repository/pur/PurRepository.java#L3439-L3475","documentation":"In collaborative Pentaho repositories, files can be locked by a user for editing. When saving with checkLock enabled, if the target file is locked and the current user lacks permission to unlock it (i.e. it's someone else's lock), the save is refused with this KettleException to prevent clobbering another user's work.","triggerScenarios":"Calling PurRepository.save/saveRepositoryObject on an existing file whose UnifiedRepository file.isLocked() is true while unifiedRepositoryLockService.canUnlockFileById(id) is false.","commonSituations":"Two developers editing the same transformation in Spoon; a stale lock left by a crashed session or departed user; saving under an account with no lock-admin rights over a locked file.","solutions":["Ask the lock owner to save and release the lock, then retry","Unlock the file via the repository browser (Lock > Unlock) or unifiedRepositoryLockService.unlockFileById(id) if you have permission","Admin: force-unlock the file in Pentaho User Console / repository admin","Save to a new name/path with 'Save As' if the lock cannot be released"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"RepositoryFile f = pur.getFileById(id.getId());\nboolean blocked = f.isLocked() && !unifiedRepositoryLockService.canUnlockFileById(id);\nif (blocked) throw new KettleException(\"File \" + f.getName() + \" is locked by another user\");","typeGuard":null,"tryCatchPattern":"try {\n  repository.save(element, comment, null, true);\n} catch (KettleException e) {\n  if (e.getMessage() != null && e.getMessage().contains(\"locked by another user\")) {\n    // surface lock-owner info to the user; offer Save As or unlock request\n  } else throw e;\n}","preventionTips":["Check lock status via the repository browser before editing shared files","Acquire a lock yourself before long edits","Coordinate team access to shared transformations; admin-force-unlock stale locks"],"tags":["kettle","pentaho","repository","file-lock","concurrency"],"backgroundTag":"permission-denied","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"}