When an attachment is uploaded using the POST /attachments/upload API (for example, during case creation in a form), Pega first creates a temporary attachment instance.
The API returns a unique attachment ID to the client.
At this stage, the attachment is stored as an instance of Data-WorkAttach-File-Temp in the pegadata.pc_data_file_temp table.
This temporary attachment does not yet have a Link-Attachment relationship with a case, so it is effectively an orphan attachment until the case is created or updated.
This behavior is independent of the configured attachment storage option:
Database storage – the file content is stored in the Pega database.
Repository storage – the file content is stored in the configured external repository.
In both scenarios, a temporary attachment record is created first.
If the user cancels the operation (for example, cancels case creation, delete action):
The temporary attachment remains in the temp table.
Pega automatically cleans up the temporary attachment after ~2 hours (Did not verify this but hope it works that way)
If the storage option is repository, the file is also removed from the repository during the same cleanup process. There were some fixes done in v25.1.2 patch regarding this cleanup which i have to check more in detail.
No need to wait to upload again. The error message mentioned by you could be because the storage repository might not be responding due to intermittent connectivity issues.
Check the tracer and logs to see if you have any specific error.
I am in 25.1.2 and have tried to delete the file and re-upload again. It works flawlessly. Below is my setup.
As JC mentioned, this works fine in 25.1.x version. If you ccheck your network tracer, it will perform the disassociate the deleted doc ID once the assignment is submitted .
Upload an attachment using an attachment property but not the attachment gadget in utility bar (immediately it creates a Data-WorkAttach-File-Temp and also uploads it to repository)
Delete it without clicking on Save/Submit (Now there is no action from system, ideally it should delete the Data-WorkAttach-File-Temp instance which will delete it from the repository as well. This delete is only happening when you save the case.)
And as the previous file is actually not deleted in the repository, I believe system is throwing an error if we upload the file with same name. This seems to be an issue with the platform. Please raise an INC so that they can investigate further.
If you need an immediate fix, pyFormatAttachmentName - In this rule, append current datetime stamp to your file name so that its always unique and there will be no error when you try to upload the file name again immediately after deleting and without saving the case.