Delete Snapshot
The snapshot delete command deletes a specific snapshot.
Bash
zeysdk snapshot delete <SNAPSHOT_ID>
Parameters
| Parameter | Description | Required | Example |
|---|---|---|---|
SNAPSHOT_ID | ID of snapshot to remove | Yes | 20231101-123456 |
Process
-
Snapshot Lookup
- Accepts IDs with or without the
.zipsuffix - Accepts only a safe snapshot filename and rejects directory separators or traversal
- Verifies the resolved archive remains within
.zeysdk/snapshots - Stops when the snapshot does not exist
- Accepts IDs with or without the
-
Deletion
- Removes the snapshot archive
- Removes the snapshot metadata entry
- Reports successful removal
Examples
Bash
zeysdk snapshot delete 20231101-123456
Error Handling
| Error | Description | Resolution |
|---|---|---|
| Invalid ID | ID is empty, contains unsafe characters, or contains a path | Copy the ID from snapshot list |
| Not found | Snapshot archive does not exist | Check snapshot list |
| Access denied | Permission issue | Check file permissions |
Notes
- Delete removes the snapshot archive from local storage
- Delete also removes the matching metadata entry
- The archive is first renamed to a same-directory tombstone; if the atomic metadata update fails, the original archive name is restored
- Invalid or unreadable snapshot metadata stops deletion before the archive is moved
- Delete does not prompt for confirmation when called directly
- Snapshot deletion cannot be undone
- Use
zeysdk snapshot listto find the exact snapshot ID
Best Practices
- Keep snapshots that mark stable milestones
- Remove old snapshots after they are no longer needed
- Verify a newer snapshot exists before deleting an older known-good one
- Avoid deleting snapshots during active rollback work