{"record":{"id":"ffb31ef03fed89cb","repo":"gitbutlerapp/gitbutler","slug":"cannot-create-alias-name-it-conflicts-with-a-built-in","errorCode":null,"errorMessage":"Cannot create alias '{name}': it conflicts with a built-in command","messagePattern":"Cannot create alias '(.+?)': it conflicts with a built-in command","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/but/src/command/alias.rs","lineNumber":221,"sourceCode":"    user_aliases\n}\n\n/// Get all default aliases\nfn get_default_aliases() -> Vec<(String, String)> {\n    crate::alias::get_all_default_aliases()\n}\n\n/// Add a new alias\npub fn add(\n    ctx: Option<&Context>,\n    out: &mut OutputChannel,\n    name: &str,\n    value: &str,\n    global: EditGlobalConfig,\n) -> Result<()> {\n    // Validate alias name doesn't conflict with known commands\n    if crate::alias::is_known_subcommand(name) {\n        anyhow::bail!(\"Cannot create alias '{name}': it conflicts with a built-in command\");\n    }\n\n    let is_global: bool = global.into();\n    let repo = ctx.map(|ctx| ctx.repo.get()).transpose()?;\n    edit_git_config(repo.as_deref(), global, |config| {\n        set_alias(config, name, value)?;\n        Ok(())\n    })?;\n\n    if let Some(out) = out.for_human() {\n        let t = theme::get();\n        writeln!(\n            out,\n            \"{} Alias '{}' {} '{}'\",\n            t.sym().success,\n            t.config_key.paint(name),\n            t.sym().arrow,\n            t.config_value.paint(value)","sourceCodeStart":203,"sourceCodeEnd":239,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/58e5313667b857ef39a730e380af31816a7b1768/crates/but/src/command/alias.rs#L203-L239","documentation":"Validation in the alias add command: the requested alias name collides with a built-in 'but' subcommand (checked via is_known_subcommand), which would make the alias unresolvable or shadow real commands. Choose a different alias name that is not a known subcommand.","triggerScenarios":"Calling `but alias add <name> <value>` (add in crates/but/src/command/alias.rs) with a name for which crate::alias::is_known_subcommand(name) returns true — e.g. `but alias add commit ...` or `but alias add push ...`.","commonSituations":"Users porting git alias habits (e.g. aliasing `co`, `commit`) to but; typos intended as alias values being placed in the name position.","solutions":["Choose an alias name that is not a built-in `but` subcommand (e.g. `bc` instead of `commit`).","Run `but --help` to list reserved subcommand names before adding the alias.","If you meant to change the command's behavior, that requires changing but itself, not an alias."],"exampleFix":"// before\nbut alias add commit \"mcp commit --all\"\n// after\nbut alias add c \"mcp commit --all\"","handlingStrategy":"validation","validationCode":"const BUILTIN = ['init','status','commit','push','pull','branch','mcp','agent','config','alias'];\nif (BUILTIN.includes(aliasName)) throw new Error(`Alias '${aliasName}' conflicts with a built-in command; pick another name`);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Check `but --help` for reserved subcommand names before choosing an alias.","Prefix custom aliases (e.g. `b-` or a short unique token) to avoid collisions.","Keep an internal list of taken alias names in team documentation."],"tags":["cli","alias","naming-conflict","validation"],"backgroundTag":"name-conflict","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"}