{"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":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/but/src/command/config.rs","lineNumber":953,"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":935,"sourceCodeEnd":971,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/58e5313667b857ef39a730e380af31816a7b1768/crates/but/src/command/config.rs#L935-L971","documentation":"Raised in `gitlab_auth` (crates/but/src/command/config.rs:953) when the interactive prompt for choosing a GitLab authentication method (PAT or Self-Hosted) yields no selection — `prompt_select(...)` returned `None`.","triggerScenarios":"During `gitlab_auth`, the user aborts the method prompt or stdin is not interactive/EOF, so no `AuthMethod` is returned and the `ok_or_else` fires.","commonSituations":"Running the config command through a script or CI without a TTY; pressing Ctrl+C/Esc at the prompt; terminal emulators that don't support the select prompt.","solutions":["Re-run the command in an interactive terminal and choose PAT or Self-Hosted","Configure the GitLab token non-interactively (config file or environment) if scripting","Check terminal support for the interactive prompt (raw-mode/TTY) and TERM settings","If self-hosted, verify you intend the Self-Hosted option and complete that sub-flow"],"exampleFix":"// before\nbut config forge auth < /dev/null   # EOF at prompt\n// after\nbut config forge auth   # interactively select \"Personal Access Token\"","handlingStrategy":"try-catch","validationCode":"use std::io::IsTerminal;\nif !std::io::stdin().is_terminal() {\n    return Err(\"GitLab auth prompt requires a TTY; supply a PAT via config instead\");\n}","typeGuard":null,"tryCatchPattern":"match gitlab_auth(input).await {\n    Err(e) if e.to_string().contains(\"Could not determine authentication method\") => eprintln!(\"select PAT or Self-Hosted at the prompt\"),\n    other => other,\n}","preventionTips":["Answer the method prompt rather than aborting it","Configure GitLab tokens non-interactively in CI","Verify terminal raw-mode support before running prompts"],"tags":["cli","authentication","gitlab"],"backgroundTag":"missing-required-option","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"}