Why did the Cleaning up step take much longer than usual?

Last updated: August 4, 2026

Context

In most builds, the Cleaning up step completes in a few seconds. Occasionally, this step may take significantly longer, sometimes up to 10 to 15 minutes or more, which can be unexpected and confusing.

Answer

The duration of the Cleaning up step depends on what needs to happen after your build has finished.

In most builds, an existing cache is restored at the beginning of the build, and no new cache needs to be uploaded at the end. In this case, the Cleaning up step finishes quickly.

However, the Cleaning up step can take significantly longer in the following situations:

  1. A new cache is being created and uploaded. This happens when:

    • A new cache path was added. Since there is no existing cache for that path, Codemagic needs to create and upload one.

    • The previous cache is no longer valid. For example, the cache may have expired, been manually cleared, or the dependency files used as the cache key have changed.

  2. Remote access (SSH/VNC) was enabled. When remote access is enabled for a build, Codemagic keeps the build machine available for a short period after the build finishes so you can connect and debug the environment. During this time, the Cleaning up step remains active until the remote access session expires or is terminated. This is expected behavior.

This behavior is expected. Once a new cache has been created and uploaded, subsequent builds should return to completing the Cleaning up step in just a few seconds, provided the cache paths remain the same and the cache stays valid. Likewise, if remote access is not enabled, the Cleaning up step should typically complete quickly.

For more information, see: