{"record":{"id":"b805aec768a81adf","repo":"git-ecosystem/git-credential-manager","slug":"remoteuri-must-be-defined-to-generate-bitbucket-dc","errorCode":null,"errorMessage":"RemoteUri must be defined to generate Bitbucket DC OAuth2 endpoint Urls","messagePattern":"RemoteUri must be defined to generate Bitbucket DC OAuth2 endpoint Urls","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/Atlassian.Bitbucket/DataCenter/BitbucketOAuth2Client.cs","lineNumber":74,"sourceCode":"        {\n            // Check for developer override value\n            if (settings.TryGetSetting(\n                DataCenterConstants.EnvironmentVariables.OAuthClientSecret,\n                Constants.GitConfiguration.Credential.SectionName, DataCenterConstants.GitConfiguration.Credential.OAuthClientSecret,\n                out string clientSecret))\n            {\n                return clientSecret;\n            }\n\n            throw new ArgumentException(\"Bitbucket DC OAuth Client Secret must be defined\");\n        }\n\n        private static OAuth2ServerEndpoints GetEndpoints(ISettings settings)\n        {\n            var remoteUri = settings.RemoteUri;\n            if (remoteUri == null)\n            {\n                throw new ArgumentException(\"RemoteUri must be defined to generate Bitbucket DC OAuth2 endpoint Urls\");\n            }\n\n            return new OAuth2ServerEndpoints(\n                new Uri(BitbucketHelper.GetBaseUri(remoteUri) + \"/rest/oauth2/latest/authorize\"),\n                new Uri(BitbucketHelper.GetBaseUri(remoteUri) + \"/rest/oauth2/latest/token\")\n                );\n        }\n    }\n}\n","sourceCodeStart":56,"sourceCodeEnd":84,"githubUrl":"https://github.com/git-ecosystem/git-credential-manager/blob/e8ce762cd04b4100ae637b5fbf39ef9d0a96561e/src/Atlassian.Bitbucket/DataCenter/BitbucketOAuth2Client.cs#L56-L84","documentation":"BitbucketOAuth2Client.GetEndpoints builds the authorize/token endpoint URLs from settings.RemoteUri. If RemoteUri is null there is no server to point the OAuth2 flow at, so it throws ArgumentException before any network call is made.","triggerScenarios":"Invoking BitbucketOAuth2Client (e.g. GetCredentialAsync) with an ISettings whose RemoteUri property is null — typically when the helper is invoked without a full remote URL in the query (no protocol=..., host=..., path=... parameters).","commonSituations":"Manually invoking git-credential fill with incomplete input; credential helpers wired up without remote URL info; custom tooling calling GCM's API with an empty or malformed remote URI.","solutions":["Ensure git passes the full remote info: run the flow via `git fetch/push` against a proper Bitbucket DC remote URL.","When invoking `git credential fill` manually, include protocol=, host= and path= lines in the input.","Check the repository's origin URL is not empty/malformed (git remote -v) and fix it with git remote set-url."],"exampleFix":"// before: incomplete input to the credential helper\n$ echo \"protocol=https\" | git credential fill  # no host\n// after:\n$ printf \"protocol=https\\nhost=bitbucket.example.com\\npath=/scm/proj/repo.git\\n\" | git credential fill","handlingStrategy":"validation","validationCode":"if (string.IsNullOrEmpty(settings.RemoteUri)) throw new InvalidOperationException(\"Run via git with a valid remote URL\");","typeGuard":"function hasRemoteUri(s) { return typeof s?.RemoteUri === 'string' && s.RemoteUri.length > 0; }","tryCatchPattern":"try { var endpoints = GetEndpoints(settings); } catch (ArgumentException ex) when (ex.Message.Contains(\"RemoteUri\")) { /* re-run through git so host/path are supplied */ }","preventionTips":["Always invoke the credential helper through git so protocol/host/path are passed","When scripting `git credential fill`, include protocol, host, and path lines","Check `git remote -v` for empty or malformed origin URLs"],"tags":["bitbucket","oauth2","configuration","git-credential-manager"],"backgroundTag":"missing-required-argument","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"}