Hi,
This message usually appears when the Mendix runtime cleanup task tries to delete a physical file that is still referenced somewhere in the application. Internally Mendix keeps track of files through two things:
System.FileDocument → the actual file entitysystem$unreferencedfile → temporary entries created when a file becomes orphanedDuring the cleanup process the runtime attempts to remove files listed in system$unreferencedfile. If Mendix detects that the file is still referenced or locked, it logs the error you are seeing:
Prevented deletion of one or more files that are still in use
So the problem is usually inconsistent metadata between the file reference and the cleanup table, not the file itself.
Regarding the two options mentioned:
System.FileDocumentThis should only be done if those files are truly no longer needed. Since you mentioned you still need those documents, this is not the right approach.
system$unreferencedfileYes, this is actually the safer fix in situations like this. That table only contains temporary cleanup records used by the runtime. Removing rows from system$unreferencedfile does not delete the actual files or the System.FileDocument entries.
The usual approach is:
system$unreferencedfile
After that the cleanup process runs normally again and the error disappears.
This situation typically occurs when:
In those cases the cleanup table keeps stale entries.
Your plan (option 2) is correct:
system$unreferencedfileThis resolves the issue in most environments and does not affect existing FileDocument records or stored files.
If the issue keeps appearing frequently, it is worth checking custom file handling logic or integrations that might be creating inconsistent file references.