Symptom
During the debugging of an atomic service, many APIs related to file writing (such as downloadFile and CameraContext.takePhoto) fail to be called after being called for multiple times.
Context
Currently, the sandbox space of an atomic service is limited. When the sandbox capacity is exhausted, APIs related to file writing will fail to be called because files cannot be written.
For HarmonyOS SDK versions earlier than 6.1.0(23), the sandbox limit is 200 MB. For HarmonyOS SDK 6.1.0(23) and later versions, the sandbox limit is 1 GB.
Possible causes
The sandbox storage is full, so file-writing operations fail and trigger API errors.
Solution
During debugging, manually uninstall the atomic service and run it again to clear the sandbox data.
Recommendation
When using APIs related to file writing, you are advised to call FileSystemManager.unlink to delete temporary files that do not need to be persisted.