{"record":{"id":"85f579c265b84bb3","repo":"gitbutlerapp/gitbutler","slug":"stack-name-stack-is-ambiguous-in-the-current-w","errorCode":null,"errorMessage":"Stack name '{stack}' is ambiguous in the current workspace","messagePattern":"Stack name '(.+?)' is ambiguous in the current workspace","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/but-debug/src/command/api.rs","lineNumber":88,"sourceCode":"                ref_name == name || ref_name.shorten().as_bstr() == name.as_bytes()\n            })\n        })\n    }\n    if let Ok(stack_id) = stack.parse::<StackId>() {\n        return Ok(stack_id);\n    }\n\n    let (_guard, _repo, workspace, _db) = ctx.workspace_and_db()?;\n    let mut matches = workspace.stacks.iter().filter_map(|workspace_stack| {\n        stack_matches(workspace_stack, stack)\n            .then_some(workspace_stack.id)\n            .flatten()\n    });\n    let Some(stack_id) = matches.next() else {\n        bail!(\"Could not resolve stack '{stack}' by UUID or workspace branch name\");\n    };\n    if matches.next().is_some() {\n        bail!(\"Stack name '{stack}' is ambiguous in the current workspace\");\n    }\n    Ok(stack_id)\n}\n","sourceCodeStart":70,"sourceCodeEnd":92,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/58e5313667b857ef39a730e380af31816a7b1768/crates/but-debug/src/command/api.rs#L70-L92","documentation":"resolve_stack_id found more than one stack in the workspace matching the supplied identifier, so the result would be ambiguous. Rather than picking an arbitrary stack, it bails asking the caller to disambiguate. A single match returns Ok(stack_id).","triggerScenarios":"Calling resolve_stack_id (e.g. via unapply_stack) with a `stack` string that matches the UUID prefix or workspace branch name of two or more entries in workspace.stacks — the second call to matches.next() returns Some.","commonSituations":"Two stacks whose branch names share the matched name (e.g. same branch name pushed in different stacks), a UUID prefix that collides with another stack's id, or duplicated branch names after copying stacks between workspaces.","solutions":["Use the full, exact stack UUID instead of a name or prefix so the match is unique","Rename one of the conflicting workspace branches so names are unique, then retry","Unapply/archive one of the duplicate stacks first, then reference the remaining one","List workspace.stacks and pass the stack id of the exact stack you intend"],"exampleFix":"// before\nlet id = api.resolve_stack_id(&mut ws, \"feature\")?; // matches two stacks\n// after\nlet id = api.resolve_stack_id(&mut ws, \"0f3b9c1e-4d2a-...full-uuid\")?;","handlingStrategy":"validation","validationCode":"let hits: Vec<_> = workspace.stacks.iter().filter(|s| stack_matches(s, stack)).collect();\nif hits.len() > 1 { eprintln!(\"ambiguous: use the full UUID\"); }","typeGuard":null,"tryCatchPattern":"match api.resolve_stack_id(&mut ws, stack) {\n    Err(e) if e.to_string().contains(\"is ambiguous\") => eprintln!(\"pass the full stack UUID instead\"),\n    other => other?,\n}","preventionTips":["Prefer full stack UUIDs over name/prefix matching in scripts","Keep workspace branch names unique across stacks","Deduplicate or archive stale stacks with overlapping names"],"tags":["cli","debug","stack","ambiguity"],"backgroundTag":"invalid-argument-value","analyzedSha":"58e5313667b857ef39a730e380af31816a7b1768","analyzedAt":"2026-09-18T06:50:32.052Z","contentChangedAt":"2026-09-18T06:50:32.052Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}