{"record":{"id":"4cbd375015d1e95e","repo":"gitbutlerapp/gitbutler","slug":"could-not-determine-authentication-method","errorCode":null,"errorMessage":"Could not determine authentication method","messagePattern":"Could not determine authentication method","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"warning","filePath":"crates/but/src/command/config.rs","lineNumber":987,"sourceCode":"            match method {\n                AuthMethod::Pat => \"Personal Access Token (PAT)\".to_string(),\n                AuthMethod::SelfHosted => \"Self-Hosted GitLab\".to_string(),\n            }\n        }\n    }\n\n    let mut input = out\n        .prepare_for_terminal_input()\n        .context(\"Human input required - run this in a terminal\")?;\n    let auth_methods = nonempty::nonempty![\n        (\"Personal Access Token (PAT)\", AuthMethod::Pat),\n        (\"Self-Hosted GitLab\", AuthMethod::SelfHosted)\n    ];\n\n    let selected_method = input\n        .prompt_select(\"Select an authentication method\", &auth_methods)?\n        .cloned()\n        .ok_or_else(|| anyhow::anyhow!(\"Could not determine authentication method\"))?;\n\n    match selected_method {\n        AuthMethod::Pat => gitlab_pat(input).await,\n        AuthMethod::SelfHosted => gitlab_self_hosted(input).await,\n    }\n}\n\n/// Authenticate with GitLab using a Personal Access Token (PAT)\nasync fn gitlab_pat(mut inout: InputOutputChannel<'_>) -> Result<()> {\n    use but_gitlab::AuthStatusResponse;\n\n    let input = inout\n        .prompt_secret(\"Please enter your GitLab Personal Access Token (PAT) and hit enter:\")?\n        .context(\"No PAT provided. Aborting authentication.\")?;\n\n    let AuthStatusResponse { username, .. } = but_api::gitlab::store_gitlab_pat(input)\n        .await\n        .map_err(|err| err.context(\"Authentication failed\"))?;","sourceCodeStart":969,"sourceCodeEnd":1005,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/caf1f223d3cfb94488c9198ad34487c6006c648f/crates/but/src/command/config.rs#L969-L1005","documentation":"GitLab authentication setup prompts for a method (Personal Access Token vs Self-Hosted GitLab) via prompt_select; the error is raised when that picker yields no selection. It means the chooser was cancelled/aborted before an entry was confirmed, so there is no AuthMethod to dispatch to gitlab_pat()/gitlab_self_hosted(). Purely a cancellation guard.","triggerScenarios":"Running GitLab auth flow and pressing Esc / killing the fuzzy picker before selecting 'Personal Access Token (PAT)' or 'Self-Hosted GitLab'.","commonSituations":"Backing out after realizing you don't have a PAT at hand; aborting to go read the required scopes first; flaky terminal over SSH.","solutions":["Create the GitLab PAT first (scopes: api/read_user as needed), then re-run and pick 'Personal Access Token (PAT)'.","For self-managed GitLab, have the instance URL ready, re-run and pick 'Self-Hosted GitLab'.","Confirm the pick with Enter; Esc/Ctrl-C is treated as 'no method' and errors here."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"match gitlab_auth(out).await {\n    Err(e) if e.to_string().contains(\"Could not determine authentication method\") => {\n        println!(\"GitLab auth cancelled.\"); Ok(())\n    }\n    other => other,\n}","preventionTips":["Prepare the PAT (or self-hosted URL) before launching the flow.","Confirm picker entries with Enter; Esc always aborts to this error."],"tags":["interactive","picker","gitlab","auth"],"backgroundTag":"prompt-cancelled","analyzedSha":"caf1f223d3cfb94488c9198ad34487c6006c648f","analyzedAt":"2026-08-20T07:55:40.983Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}