{"record":{"id":"51b7f8e98af3e07f","repo":"git-ecosystem/git-credential-manager","slug":"bitbucket-dc-oauth-client-id-must-be-defined","errorCode":null,"errorMessage":"Bitbucket DC OAuth Client ID must be defined","messagePattern":"Bitbucket DC OAuth Client ID must be defined","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/Atlassian.Bitbucket/DataCenter/BitbucketOAuth2Client.cs","lineNumber":38,"sourceCode":"\n        public override IEnumerable<string> Scopes => new string[] {\n            DataCenterConstants.OAuthScopes.PublicRepos,\n            DataCenterConstants.OAuthScopes.RepoRead,\n            DataCenterConstants.OAuthScopes.RepoWrite\n        };\n\n        private static string GetClientId(ISettings settings)\n        {\n            // Check for developer override value\n            if (settings.TryGetSetting(\n                DataCenterConstants.EnvironmentVariables.OAuthClientId,\n                Constants.GitConfiguration.Credential.SectionName, DataCenterConstants.GitConfiguration.Credential.OAuthClientId,\n                out string clientId))\n            {\n                return clientId;\n            }\n\n            throw new ArgumentException(\"Bitbucket DC OAuth Client ID must be defined\");\n        }\n\n        private static Uri GetRedirectUri(ISettings settings)\n        {\n            // Check for developer override value\n            if (settings.TryGetSetting(\n                DataCenterConstants.EnvironmentVariables.OAuthRedirectUri,\n                Constants.GitConfiguration.Credential.SectionName, DataCenterConstants.GitConfiguration.Credential.OAuthRedirectUri,\n                out string redirectUriStr) && Uri.TryCreate(redirectUriStr, UriKind.Absolute, out Uri redirectUri))\n            {\n                return redirectUri;\n            }\n\n            return DataCenterConstants.OAuth2RedirectUri;\n        }\n\n        private static string GetClientSecret(ISettings settings)\n        {","sourceCodeStart":20,"sourceCodeEnd":56,"githubUrl":"https://github.com/git-ecosystem/git-credential-manager/blob/e8ce762cd04b4100ae637b5fbf39ef9d0a96561e/src/Atlassian.Bitbucket/DataCenter/BitbucketOAuth2Client.cs#L20-L56","documentation":"BitbucketOAuth2Client.GetClientId reads the OAuth client ID from the Git credential config (DataCenterConstants.GitConfiguration.Credential.OAuthClientId under the credential section). If no value is stored there, it cannot construct the OAuth2 authorization request and throws ArgumentException. Bitbucket Data Center requires an admin-provisioned OAuth client for the app-password/OAuth flow.","triggerScenarios":"Calling the Bitbucket DC OAuth2 credential flow (GetCredentialAsync via BitbucketOAuth2Client) when `credential.bitbucketDCOAuthClientId` (DataCenterConstants...OAuthClientId) is not set in the Git configuration.","commonSituations":"Fresh GCM install against a Bitbucket Data Center server without the required OAuth client config; admin never provisioned an OAuth application; config written under the wrong section/hostname scope; upgrades where DC-specific keys were never migrated.","solutions":["Set the client ID in Git config: git config --global credential.bitbucketDCOAuthClientId <your-client-id>","Verify the key name and credential section scope matches the repository host (use credential.<url>.bitbucketDCOAuthClientId for per-host config).","Have the Bitbucket DC admin create an OAuth application (incoming link) and supply both client ID and secret."],"exampleFix":"// before: throws because no client ID configured\n// after:\n$ git config --global credential.bitbucketDCOAuthClientId 0a1b2c3d4e5f\n$ git config --global credential.bitbucketDCOAuthClientSecret my-secret","handlingStrategy":"validation","validationCode":"$ git config --get credential.bitbucketDCOAuthClientId || echo \"client id missing\"\n# C#: bool ok = settings.TryGetSetting(Constants.GitConfiguration.Credential.SectionName,\n#     DataCenterConstants.GitConfiguration.Credential.OAuthClientId, out _);","typeGuard":null,"tryCatchPattern":"try { await oauth2Client.GetCredentialAsync(); } catch (ArgumentException ex) when (ex.Message.Contains(\"Client ID\")) { /* report missing config, point admin to OAuth app setup */ }","preventionTips":["Provision both bitbucketDCOAuthClientId and bitbucketDCOAuthClientSecret during DC onboarding","Document the required git config keys for Bitbucket DC users","Validate config in setup scripts before first git operation"],"tags":["bitbucket","oauth2","configuration","git-credential-manager"],"backgroundTag":"missing-required-config-field","analyzedSha":"e8ce762cd04b4100ae637b5fbf39ef9d0a96561e","analyzedAt":"2026-09-11T17:15:08.753Z","contentChangedAt":"2026-09-11T17:15:08.753Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}