gitbutlerapp/gitbutler · error
Comment is archived and cannot be updated
Error message
Comment {id} is archived and cannot be updated What it means
update_payload() refuses to edit a comment that has been archived (archived_at_ms is set). Archived comments are treated as immutable history, so any payload update is rejected even though the id still resolves.
Solutions
- Check comment.archived_at_ms.is_none() before attempting the update
- Unarchive the comment first if your workflow allows it, then update
- Discard the pending edit and inform the user the comment was archived
- Re-sync UI state on archive events so stale editors cannot save
Example fix
// before
update_payload(&store, id, text, now)?;
// after
let c = store.get(id)?;
if c.archived_at_ms.is_none() {
update_payload(&store, id, text, now)?;
} else {
eprintln!("Comment is archived; not updating");
} Defensive patterns
Strategy: type-guard
Validate before calling
fn editable(c: &Comment) -> bool { c.archived_at_ms.is_none() } Type guard
if comment.archived_at_ms.is_none() { /* safe to update */ } Try / catch
match update_payload(&store, id, text, now) {
Err(e) if e.to_string().contains("archived") => discard_edit_and_notify(),
other => other?,
} Prevention
- Check archived state before opening an editor for a comment
- Listen for archive events and disable stale editors
- Avoid blind retries of failed updates
- Keep archive/unarchive flows explicit in the UI
When it happens
Trigger: Calling update_payload on a comment whose archived_at_ms field is Some, typically after the user archived the comment in the UI or the system auto-archived resolved threads.
Common situations: Two windows open on the same workspace: one archives the comment, the other still has the editor open and tries to save; automation updating comments without checking archive state; retry of a queued edit after archival.
Understand the failure class
Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.
Related errors
- Cannot comment on : the diff is binary or too large
- No comment with id
- Nothing to anchor a comment to in
- Review comments for forge
- Worktree is archived
AI-assisted analysis of gitbutlerapp/gitbutler@58e5313667 (2026-09-18).
Data as JSON: /api/errors/3ff44b36d737f93a.
Report an issue: GitHub.
Appendix: source
Thrown at crates/but-comments/src/lib.rs:350
/// Whether the listing wrote to the store (persisted drift, auto-archived comments, or
/// purged old archived rows). Callers that bridge processes can use this to notify other
/// consumers of the store.
pub persisted_changes: bool,
}
/// Replace the payload of the unarchived comment with the given `id`.
pub fn update_payload(
store: &CommentStore,
id: &str,
payload: String,
now_ms: i64,
) -> anyhow::Result<()> {
store.update(|comments| {
let Some(comment) = comments.iter_mut().find(|c| c.id == id) else {
bail!("No comment with id {id}");
};
if comment.archived_at_ms.is_some() {
bail!("Comment {id} is archived and cannot be updated");
}
comment.payload = payload;
comment.updated_at_ms = now_ms;
Ok(())
})
}
/// Archive the comment with the given `id`, hiding it from all future listings.
/// Returns `false` if the comment does not exist or was already archived.
pub fn archive_comment(store: &CommentStore, id: &str, now_ms: i64) -> anyhow::Result<bool> {
store.update(|comments| {
Ok(
match comments
.iter_mut()
.find(|c| c.id == id && c.archived_at_ms.is_none())
{
Some(comment) => {
comment.archived_at_ms = Some(now_ms);View on GitHub (pinned to 58e5313667)