gitbutlerapp/gitbutler · info · serde_error::Error
assignments_error.map(|err| serde_error::Error::new(&*err))
Error message
assignments_error.map(|err| serde_error::Error::new(&*err))
What it means
In `assignments_and_errors`, the anyhow assignment error is mapped into a serializable `serde_error::Error` before being returned to `emit_worktree_changes`, so the UI receives the assignment failure message alongside the (possibly empty) assignment results. The error is intentionally non-fatal: results and error travel together.
Solutions
- Inspect the `assignments_error` string on the emitted event for the root cause.
- Retry by triggering a status refresh once the conflicting operation completes.
- Remove stale assignment rules pointing at deleted branches.
- If the workspace database is locked, close other GitButler clients on the same project.
Defensive patterns
Strategy: try-catch
Try / catch
let (assignments, err) = assignments_and_errors(...)?;
if let Some(e) = err {
tracing::warn!(error = %e, "assignment failed; falling back to unassigned view");
} Prevention
- Avoid concurrent clients on the same project while the watcher runs.
- Clean up assignment rules that reference deleted branches.
- Trigger a manual status refresh after failed ticks.
When it happens
Trigger: Calling the worktree-changes pipeline when `but_hunk_assignment` fails to compute assignments (e.g. reference resolution failure, database error, conflicting assignment rules), so `assignments_error` is `Some` and gets converted for the event payload.
Common situations: Workspace database locked or mid-migration while the watcher polls; assignment rules referencing deleted branches; concurrent CLI and app operations on the same project corrupting intermediate state.
Related errors
- assignments_error: assignments_error.clone()…
- assignments_error: assignments_error.map(|err|…
- BUG: Sensitive data cannot be serialized - it needs to be…
- Failed to serialize hunk_header
- Failed to stop project watcher
AI-assisted analysis of gitbutlerapp/gitbutler@58e5313667 (2026-09-18).
Data as JSON: /api/errors/4fe7aa017457ac7e.
Report an issue: GitHub.
Appendix: source
Thrown at crates/gitbutler-watcher/src/handler.rs:264
fn assignments_and_errors(
db: HunkAssignmentsHandleMut,
repo: &gix::Repository,
workspace: &but_graph::Workspace,
tree_changes: Vec<TreeChange>,
context_lines: u32,
) -> Result<(Vec<HunkAssignment>, Option<serde_error::Error>)> {
let (assignments, assignments_error) = {
but_hunk_assignment::assignments_with_fallback(
db,
repo,
workspace,
Some(tree_changes),
context_lines,
)?
};
Ok((
assignments,
assignments_error.map(|err| serde_error::Error::new(&*err)),
))
}
View on GitHub (pinned to 58e5313667)