Intermittent Git authentication failures on scheduled/automated operations — valid credentials not recognised

XMLWordPrintable

    • 1
    • Severity 3 - Minor
    • 433

      Issue Summary

      Some customers running automated Git operations (CI runners, scheduled jobs, etc.) against Bitbucket Cloud intermittently receive HTTP 401 errors with the message Invalid Git provider Personal Access Token credentials for repository URL …, even though the credential is valid and unchanged. The same token successfully authenticates requests immediately before and after each failure. The issue appears to be timing-dependent, with failures more likely when multiple automated jobs execute Git operations against the same workspace within a narrow time window (e.g., within 1–2 minutes of each other).

      This issue is not related to token rotation, expiration, scope, revocation, or the CHANGE-3052 OAuth deprecation.

      Steps to Reproduce

      1. Configure two or more automated jobs (e.g., Databricks scheduled notebooks, CI runners) to perform Git checkout/clone/fetch operations against repositories in the same Bitbucket Cloud workspace.
      2. Schedule the jobs to run at closely spaced intervals (e.g., one at :00 and another at :01 past the hour).
      3. Use the same valid Bitbucket credential (app password, repository access token, or workspace access token) for authentication.
      4. Observe that some jobs intermittently fail with HTTP 401 while others succeed using the same credential.

      Expected Results

      All Git operations authenticate successfully using the valid credential, regardless of timing or concurrency.

      Actual Results

      Some Git operations intermittently fail with HTTP 401. The following error is returned to the client:

      Failed to checkout Git repository: UNAUTHENTICATED: Invalid Git provider Personal Access Token credentials for repository URL https://bitbucket.org/{workspace}/{repo}/src/. Credential Bitbucket Cloud credential ({credential_id}) was used because it is your default for this provider. This Git credential's provider is bitbucketCloud and email / username is {username}. 

      Workaround

      Stagger automated job start times — spacing jobs by at least 3–5 minutes reduces the likelihood of hitting this issue. In the reported case, moving a job from :01 to :03 past the hour significantly reduced visible failures.

      Additionally, the engineering team recommends enabling client-side retry with a short backoff (~30 seconds) on automated Git operations to handle any remaining intermittent failures.

              Assignee:
              Unassigned
              Reporter:
              Jairo Ortiz
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated: