ARTIFACTORY: How to overcome the error "Could not create file system item Parent <PATH> must be a folder" when attempting to delete a file/folder

ARTIFACTORY: How to overcome the error "Could not create file system item Parent <PATH> must be a folder" when attempting to delete a file/folder

AuthorFullName__c
Elina Floim
articleNumber
000005729
ft:sourceType
Salesforce
FirstPublishedDate
2023-05-18T12:37:36Z
lastModifiedDate
2023-05-18
VersionNumber
1

Under certain circumstances, attempts to delete certain files or folders in Artifactory can result in an error similar to this:

[jfrt ] [ERROR] [484a261e74d18f84] [.s.StorageInterceptorsImpl:117] [http-nio-8081-exec-6] - Failed due before delete to exception message: Could not create file system item Parent generic-local must be a folder

This behavior can occur when the file or folder that the user attempts to delete (usually in a nested folder structure) also exists in the trashcan under the same path. For example, it can occur in the following scenario:
  • A repository contains a file name - for example, the repository is named generic-local and the file name is a
  • The file gets deleted at some point and the trashcan now has an entry containing this path, e.g. generic-local/a
  • Another file is being deployed to the same repository under a similar path, for example - generic-local/a/b/c, where a is now a folder and c is the file. 
  • Attempts to delete one of the folders in this path or the c file will result in an error since the same path exists in the trashcan. 

In this case, the workaround is to either delete the content of the affected repository from the trashcan or empty the trashcan.

User-added image