gitbutlerapp/gitbutler · warning · anyhow::Error
Comment {id} is archived and cannot be updated
Error message
Comment {id} is archived and cannot be updated What it means
update_payload() found the comment with the given id but its archived_at_ms is set, so the store refuses to modify it. Archived comments are hidden from listings, yet still physically present, which is why update lands here instead of the not-found branch.
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 caf1f223d3)
Solutions
- Refresh the comment listing (archived entries are excluded) so stale edits cannot be submitted
- If the edit matters, un-archive/restore the comment first if such an API exists, or re-create it
- Guard edit UIs by checking archived state from the fresh listing before enabling save
- Treat this error as a soft conflict: notify the user the comment no longer exists actively
Defensive patterns
Strategy: validation
Validate before calling
// check archived state from the live store before enabling edit
let active = store.with(|comments| comments.iter()
.find(|c| c.id == id).map(|c| c.archived_at_ms.is_none()))?;
anyhow::ensure!(active == Some(true), "comment {id} is archived"); Try / catch
match but_comments::update_payload(&store, id, payload, now) {
Err(e) if e.to_string().contains("archived") =>
notify("this comment was archived elsewhere — edit discarded"),
r => r?,
} Prevention
- Hide archived comments from edit affordances immediately after archive actions
- Reload comment state when the window regains focus
- Treat archived-update as a conflict signal, not a hard failure
When it happens
Trigger: Updating a comment that was archived earlier via archive_comment(), typically from a UI that still shows a stale (pre-archive) view and lets the user edit it.
Common situations: Two windows open on the same review; one archives, the other submits an edit; clients replaying offline edits after a sync archived the comment.
Related errors
- No comment with id {id}
- Commit {} is not in the applied workspace
- Nothing to anchor a comment to in {scope}
- Cannot comment on {scope}: the diff is binary or too large
- There has been a malformed conflicted commit, unable to find
AI-assisted analysis of gitbutlerapp/gitbutler@caf1f223d3 (2026-08-20).
Data as JSON: /api/errors/3ff44b36d737f93a.
Report an issue: GitHub.