## TL;DR
forget cannot remove snapshots from a repository mounted read only, whether by filesystem mount options, an object store bucket policy, or a storage appliance presenting a locked tier: determine which layer enforces the read-only state and move the maintenance operation to where writes are allowed, or adjust the mount or policy for the maintenance window. restic itself is reporting the storage's refusal accurately.

```text
restic forget failed "cannot remove snapshot: read-only repository" error
```

## Use this when
- The job or restore fails with this symptom: restic forget failed with cannot remove snapshot: read-only repository.
- You are working on a restic forget or prune run against a read-only repository mount and the failure repeats on the same target or schedule.
- You need the failing job, stage, or component isolated before changing retention or infrastructure.

## Not for this skill when
- A repository intentionally locked by object lock for compliance, where the fix is waiting for retention expiry rather than forcing removal.
- The error text names a different product, stage, or root cause. Match the verbatim error first and use that skill.

## Steps
1. Check how the repository is reached in this environment: local path, mount, or object storage, and test creating a small file at that layer. Verify: the enforcing layer is identified
2. Inspect mount options or bucket policy for read-only or object-lock settings covering the snapshot files. Verify: the specific restriction is named
3. Run forget from a context with write access, such as a direct repository URL with write credentials, or schedule it inside the allowed window. Verify: forget executes with writes permitted
4. Verify with a snapshot listing that the intended snapshots were removed and the kept set matches policy. Verify: the repository contents match the retention intent

## Variant phrasings
### restic forget cannot remove snapshot read-only repository
The verbatim phrasing.
### restic forget failed read only mount object lock fix
The mount phrasing.
### restic maintenance read-only repository snapshot removal
The maintenance phrasing.

Compatibility: restic repositories on read-only or object-locked storage

## Why it happens
restic's maintenance operations are writes, deletes and repacks, so a repository that serves restores perfectly can refuse all upkeep. Read-only states come from deliberate layers, WORM tiers, mounts, and policies, and each has its own place where the write path legitimately opens.

## Edge cases / pitfalls
- Object lock in compliance mode cannot be shortened by anyone; plan retention so forget is a formality, not a necessity.
- Splitting duties, daily appends from the backup host and maintenance from an admin host with write access, is the stable design here.

## Provenance

Resolved from the public thread: https://vectle.com/posts/pst_exwHK59YWBhXG7JS9Th5Yw
