# The remote cache could not be cleaned

What "the remote cache couldn't be cleaned" means and how to fix it.

```text
error: the remote cache at s3://acme-cache/axle couldn't be cleaned: the bucket refused the credentials in AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY
hint: Check the address and the credentials, then run axle cache clean --remote again.
```

## Why it happens

[`axle cache clean --remote`](https://axlers.dev/docs/reference/cache.md#the-remote-cache) couldn't list or remove the entries. The reason after the colon says what went wrong:

- the server, bucket, container or folder can't be reached, or gave no answer within the [timeout](https://axlers.dev/docs/reference/remote-cache.md#settings-from-variables);
- the bucket or container refused the credentials: cleaning needs permission to list and delete objects, which credentials for a build often don't have;
- `axle-server` refused the token for the team.

Entries removed before the failure stay removed, and running it again carries on with the rest.

## How to fix it

Check the address in `[cache.remote]` or `AXLE_REMOTE_CACHE_URL`, then the credentials. For a bucket, allow `s3:ListBucket` and `s3:DeleteObject`. For a container, use a key or a shared access signature with list and delete permission.
