Skip to content

GitHub Actions: Docs/Docs CI fails randomly with "fatal: shallow file has changed since we read it" error (git 2.54.0 regression) #151365

@vstinner

Description

@vstinner

Bug report

git fetch origin "+4991c6a11cdf8273484e2c48cc83289caf769a56:remotes/origin/dataclass-eq-doc-update-3-13" --depth=12 --no-tags --prune --no-recurse-submodules failed with:

From https://github.com/python/cpython
 * [new ref]         4991c6a11cdf8273484e2c48cc83289caf769a56 -> origin/dataclass-eq-doc-update-3-13
fatal: shallow file has changed since we read it

This error occurs randomly for a few weeks.

Logs: https://github.com/python/cpython/actions/runs/27361801697/job/80850919800?pr=139007

Details
Current runner version: '2.334.0'
##[group]Runner Image Provisioner
Hosted Compute Agent
Version: 20260527.539
Commit: a891dd388383b896fa6ac04a82c0b75cec981078
Build Date: 2026-05-27T21:39:57Z
Worker ID: {39f265b4-c8d0-40ac-a926-535fc3decf7c}
Azure Region: westus
##[endgroup]
##[group]Operating System
Ubuntu
24.04.4
LTS
##[endgroup]
##[group]Runner Image
Image: ubuntu-24.04
Version: 20260607.184.1
Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20260607.184/images/ubuntu/Ubuntu2404-Readme.md
Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20260607.184
##[endgroup]
##[group]GITHUB_TOKEN Permissions
Contents: read
Metadata: read
##[endgroup]
Secret source: None
Prepare workflow directory
Prepare all required actions
Getting action download info
Download action repository 'actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd' (SHA:de0fac2e4500dabe0009e67214ff5f5447ce83dd)
Download action repository 'actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405' (SHA:a309ff8b426b58ec0e2a45f0f869d46889d02405)
Download action repository 'actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f' (SHA:bbbca2ddaa5d8feaa63e36b76fdaad77386f024f)
Uses: python/cpython/.github/workflows/reusable-docs.yml@refs/pull/139007/merge (b76dbed1cbb8b37ccf2f90ba7cfeacdb9f4a0774)
Complete job name: Docs / Docs
##[group]Run actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
with:
  persist-credentials: false
  ref: 4991c6a11cdf8273484e2c48cc83289caf769a56
  repository: python/cpython
  token: ***
  ssh-strict: true
  ssh-user: git
  clean: true
  sparse-checkout-cone-mode: true
  fetch-depth: 1
  fetch-tags: false
  show-progress: true
  lfs: false
  submodules: false
  set-safe-directory: true
env:
  FORCE_COLOR: 1
  branch_base: origin/main
  branch_pr: origin/dataclass-eq-doc-update-3-13
  commits: 11
  refspec_base: +6112d70abee2455bfa44a76a49a5a80472e21134:remotes/origin/main
  refspec_pr: +4991c6a11cdf8273484e2c48cc83289caf769a56:remotes/origin/dataclass-eq-doc-update-3-13
##[endgroup]
Syncing repository: python/cpython
##[group]Getting Git version info
Working directory is '/home/runner/work/cpython/cpython'
[command]/usr/bin/git version
git version 2.54.0
##[endgroup]
Temporarily overriding HOME='/home/runner/work/_temp/d63faf59-d6d5-483f-935f-f4988a4a68fb' before making global git config changes
Adding repository directory to the temporary git global config as a safe directory
[command]/usr/bin/git config --global --add safe.directory /home/runner/work/cpython/cpython
Deleting the contents of '/home/runner/work/cpython/cpython'
##[group]Initializing the repository
[command]/usr/bin/git init /home/runner/work/cpython/cpython
hint: Using 'master' as the name for the initial branch. This default branch name
hint: will change to "main" in Git 3.0. To configure the initial branch name
hint: to use in all of your new repositories, which will suppress this warning,
hint: call:
hint:
hint: 	git config --global init.defaultBranch <name>
hint:
hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
hint: 'development'. The just-created branch can be renamed via this command:
hint:
hint: 	git branch -m <name>
hint:
hint: Disable this message with "git config set advice.defaultBranchName false"
Initialized empty Git repository in /home/runner/work/cpython/cpython/.git/
[command]/usr/bin/git remote add origin https://github.com/python/cpython
##[endgroup]
##[group]Disabling automatic garbage collection
[command]/usr/bin/git config --local gc.auto 0
##[endgroup]
##[group]Setting up auth
Removing SSH command configuration
[command]/usr/bin/git config --local --name-only --get-regexp core\.sshCommand
[command]/usr/bin/git submodule foreach --recursive sh -c "git config --local --name-only --get-regexp 'core\.sshCommand' && git config --local --unset-all 'core.sshCommand' || :"
Removing HTTP extra header
[command]/usr/bin/git config --local --name-only --get-regexp http\.https\:\/\/github\.com\/\.extraheader
[command]/usr/bin/git submodule foreach --recursive sh -c "git config --local --name-only --get-regexp 'http\.https\:\/\/github\.com\/\.extraheader' && git config --local --unset-all 'http.https://github.com/.extraheader' || :"
Removing includeIf entries pointing to credentials config files
[command]/usr/bin/git config --local --name-only --get-regexp ^includeIf\.gitdir:
[command]/usr/bin/git submodule foreach --recursive git config --local --show-origin --name-only --get-regexp remote.origin.url
[command]/usr/bin/git config --file /home/runner/work/_temp/git-credentials-3a72ad52-0885-4b0f-9f73-92d0f68a310b.config http.https://github.com/.extraheader AUTHORIZATION: basic ***
[command]/usr/bin/git config --local includeIf.gitdir:/home/runner/work/cpython/cpython/.git.path /home/runner/work/_temp/git-credentials-3a72ad52-0885-4b0f-9f73-92d0f68a310b.config
[command]/usr/bin/git config --local includeIf.gitdir:/home/runner/work/cpython/cpython/.git/worktrees/*.path /home/runner/work/_temp/git-credentials-3a72ad52-0885-4b0f-9f73-92d0f68a310b.config
[command]/usr/bin/git config --local includeIf.gitdir:/github/workspace/.git.path /github/runner_temp/git-credentials-3a72ad52-0885-4b0f-9f73-92d0f68a310b.config
[command]/usr/bin/git config --local includeIf.gitdir:/github/workspace/.git/worktrees/*.path /github/runner_temp/git-credentials-3a72ad52-0885-4b0f-9f73-92d0f68a310b.config
##[endgroup]
##[group]Fetching the repository
[command]/usr/bin/git -c protocol.version=2 fetch --no-tags --prune --no-recurse-submodules --depth=1 origin 4991c6a11cdf8273484e2c48cc83289caf769a56
From https://github.com/python/cpython
 * branch            4991c6a11cdf8273484e2c48cc83289caf769a56 -> FETCH_HEAD
[command]/usr/bin/git rev-parse --verify --quiet 4991c6a11cdf8273484e2c48cc83289caf769a56^{object}
4991c6a11cdf8273484e2c48cc83289caf769a56
##[endgroup]
##[group]Determining the checkout info
##[endgroup]
[command]/usr/bin/git sparse-checkout disable
[command]/usr/bin/git config --local --unset-all extensions.worktreeConfig
##[group]Checking out the ref
[command]/usr/bin/git checkout --progress --force 4991c6a11cdf8273484e2c48cc83289caf769a56
Note: switching to '4991c6a11cdf8273484e2c48cc83289caf769a56'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

HEAD is now at 4991c6a Merge branch 'main' into dataclass-eq-doc-update-3-13
##[endgroup]
[command]/usr/bin/git log -1 --format=%H
4991c6a11cdf8273484e2c48cc83289caf769a56
##[group]Removing auth
Removing SSH command configuration
[command]/usr/bin/git config --local --name-only --get-regexp core\.sshCommand
[command]/usr/bin/git submodule foreach --recursive sh -c "git config --local --name-only --get-regexp 'core\.sshCommand' && git config --local --unset-all 'core.sshCommand' || :"
Removing HTTP extra header
[command]/usr/bin/git config --local --name-only --get-regexp http\.https\:\/\/github\.com\/\.extraheader
[command]/usr/bin/git submodule foreach --recursive sh -c "git config --local --name-only --get-regexp 'http\.https\:\/\/github\.com\/\.extraheader' && git config --local --unset-all 'http.https://github.com/.extraheader' || :"
Removing includeIf entries pointing to credentials config files
[command]/usr/bin/git config --local --name-only --get-regexp ^includeIf\.gitdir:
includeif.gitdir:/home/runner/work/cpython/cpython/.git.path
includeif.gitdir:/home/runner/work/cpython/cpython/.git/worktrees/*.path
includeif.gitdir:/github/workspace/.git.path
includeif.gitdir:/github/workspace/.git/worktrees/*.path
[command]/usr/bin/git config --local --get-all includeif.gitdir:/home/runner/work/cpython/cpython/.git.path
/home/runner/work/_temp/git-credentials-3a72ad52-0885-4b0f-9f73-92d0f68a310b.config
[command]/usr/bin/git config --local --unset includeif.gitdir:/home/runner/work/cpython/cpython/.git.path /home/runner/work/_temp/git-credentials-3a72ad52-0885-4b0f-9f73-92d0f68a310b.config
[command]/usr/bin/git config --local --get-all includeif.gitdir:/home/runner/work/cpython/cpython/.git/worktrees/*.path
/home/runner/work/_temp/git-credentials-3a72ad52-0885-4b0f-9f73-92d0f68a310b.config
[command]/usr/bin/git config --local --unset includeif.gitdir:/home/runner/work/cpython/cpython/.git/worktrees/*.path /home/runner/work/_temp/git-credentials-3a72ad52-0885-4b0f-9f73-92d0f68a310b.config
[command]/usr/bin/git config --local --get-all includeif.gitdir:/github/workspace/.git.path
/github/runner_temp/git-credentials-3a72ad52-0885-4b0f-9f73-92d0f68a310b.config
[command]/usr/bin/git config --local --unset includeif.gitdir:/github/workspace/.git.path /github/runner_temp/git-credentials-3a72ad52-0885-4b0f-9f73-92d0f68a310b.config
[command]/usr/bin/git config --local --get-all includeif.gitdir:/github/workspace/.git/worktrees/*.path
/github/runner_temp/git-credentials-3a72ad52-0885-4b0f-9f73-92d0f68a310b.config
[command]/usr/bin/git config --local --unset includeif.gitdir:/github/workspace/.git/worktrees/*.path /github/runner_temp/git-credentials-3a72ad52-0885-4b0f-9f73-92d0f68a310b.config
[command]/usr/bin/git submodule foreach --recursive git config --local --show-origin --name-only --get-regexp remote.origin.url
Removing credentials config '/home/runner/work/_temp/git-credentials-3a72ad52-0885-4b0f-9f73-92d0f68a310b.config'
##[endgroup]
##[group]Run # Fetch enough history to find a common ancestor commit (aka merge-base):
�[36;1m# Fetch enough history to find a common ancestor commit (aka merge-base):�[0m
�[36;1mgit fetch origin "${refspec_pr}" --depth=$(( commits + 1 )) \�[0m
�[36;1m  --no-tags --prune --no-recurse-submodules�[0m
�[36;1m�[0m
�[36;1m# This should get the oldest commit in the local fetched history (which may not be the commit the PR branched from):�[0m
�[36;1mCOMMON_ANCESTOR=$( git rev-list --first-parent --max-parents=0 --max-count=1 "${branch_pr}" )�[0m
�[36;1mDATE=$( git log --date=iso8601 --format=%cd "${COMMON_ANCESTOR}" )�[0m
�[36;1m�[0m
�[36;1m# Get all commits since that commit date from the base branch (eg: master or main):�[0m
�[36;1mgit fetch origin "${refspec_base}" --shallow-since="${DATE}" \�[0m
�[36;1m  --no-tags --prune --no-recurse-submodules�[0m
shell: /usr/bin/bash -e {0}
env:
  FORCE_COLOR: 1
  branch_base: origin/main
  branch_pr: origin/dataclass-eq-doc-update-3-13
  commits: 11
  refspec_base: +6112d70abee2455bfa44a76a49a5a80472e21134:remotes/origin/main
  refspec_pr: +4991c6a11cdf8273484e2c48cc83289caf769a56:remotes/origin/dataclass-eq-doc-update-3-13
##[endgroup]
From https://github.com/python/cpython
 * [new ref]         4991c6a11cdf8273484e2c48cc83289caf769a56 -> origin/dataclass-eq-doc-update-3-13
fatal: shallow file has changed since we read it
##[error]Process completed with exit code 128.
Post job cleanup.
[command]/usr/bin/git version
git version 2.54.0
Temporarily overriding HOME='/home/runner/work/_temp/4a1d09f5-9d14-4981-b20c-31cd66167f38' before making global git config changes
Adding repository directory to the temporary git global config as a safe directory
[command]/usr/bin/git config --global --add safe.directory /home/runner/work/cpython/cpython
Removing SSH command configuration
[command]/usr/bin/git config --local --name-only --get-regexp core\.sshCommand
[command]/usr/bin/git submodule foreach --recursive sh -c "git config --local --name-only --get-regexp 'core\.sshCommand' && git config --local --unset-all 'core.sshCommand' || :"
Removing HTTP extra header
[command]/usr/bin/git config --local --name-only --get-regexp http\.https\:\/\/github\.com\/\.extraheader
[command]/usr/bin/git submodule foreach --recursive sh -c "git config --local --name-only --get-regexp 'http\.https\:\/\/github\.com\/\.extraheader' && git config --local --unset-all 'http.https://github.com/.extraheader' || :"
Removing includeIf entries pointing to credentials config files
[command]/usr/bin/git config --local --name-only --get-regexp ^includeIf\.gitdir:
[command]/usr/bin/git submodule foreach --recursive git config --local --show-origin --name-only --get-regexp remote.origin.url
Cleaning up orphan processes

By the way, the Checkout step runs git config --local gc.auto 0: according to actions/checkout#2437, this command is no longer useful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    infraCI, GitHub Actions, buildbots, Dependabot, etc.testsTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or error
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions