Skip to content

v2.56.0.vfs.0.0: git fetch fails with 'requires the GVFS protocol' when ref tip is not local (read-object hook skipped) #1004

Closed

Description

@tyrielv

Note

This issue was drafted with AI assistance and reviewed and approved by a human before posting.

Problem

In v2.56.0.vfs.0.0, git fetch fails in a mounted VFS for Git enlistment when a fetched ref tip is not yet in the local object store.

Fetching commits and trees from cache server...Succeeded
remote: This repository requires the GVFS protocol (use "gvfs clone" or "scalar clone"). Install a compatible Git client from https://github.com/microsoft/git/releases
fatal: protocol error: bad pack header

The same command succeeds with v2.55.0.vfs.0.10 in the same enlistment.

The failure is most likely on branches that move faster than the cache server publishes prefetch packs. The new tip is then in no prefetch pack yet.

Telemetry for our repo over three days shows a high exit-128 rate for fetches on this build. Six machines ran 2.56.0.vfs.0.0. Of the 55 fetches, 40 failed. The most common build, 2.55.0.vfs.0.10, fails 5.9% of the time.

Reproduction

  1. Use a mounted VFS for Git enlistment (core.virtualizeobjects=true, GVFS read-object hook installed).
  2. Pick a remote branch whose tip is not in the local object store.
  3. Run git fetch origin +refs/heads/<branch>:refs/remotes/origin/<branch> with v2.56.0.vfs.0.0.

Result: exit code 128 with the error above.
With v2.55.0.vfs.0.10 the same command exits 0.

Cause

check_exist_and_connected() in builtin/fetch.c calls odb_has_object(..., ODB_HAS_OBJECT_RECHECK_PACKED) on each ref tip. This call does not set ODB_HAS_OBJECT_FETCH_PROMISOR, so it sets OBJECT_INFO_SKIP_FETCH_OBJECT.

In do_oid_object_info_extended() in odb.c, the read-object hook call has an extra condition in v2.56.0.vfs.0.0:

/* v2.55.0.vfs.0.10 */
if (gvfs_virtualize_objects(odb->repo) && !tried_hook) {

/* v2.56.0.vfs.0.0 */
if (gvfs_virtualize_objects(odb->repo) && !tried_hook &&
    !(flags & OBJECT_INFO_SKIP_FETCH_OBJECT)) {

The condition was added on purpose. It comes from 37a046833bb, a fixup of "gvfs-helper: create tool to fetch objects using the GVFS Protocol". The fixup first appears in v2.56.0-rc0.vfs.0.0. The fixup message says a no-fetch request must also apply to the read-object hook. The goal is to stop a no-fetch lookup from downloading an object after local recovery.

The side effect is in the fetch path:

  1. The hook does not run for a missing ref tip.
  2. odb_has_object() returns false.
  3. check_exist_and_connected() returns -1, so git runs fetch-pack against the server.
  4. The server rejects the request, because it requires the GVFS protocol.

Before the change, the hook downloaded the tip. check_connected() then returned early because of GVFS_FETCH_SKIP_REACHABILITY_AND_UPLOADPACK, and git did not run upload-pack.

Evidence

Trace2 (GIT_TRACE2_EVENT) for the same fetch in the same enlistment:

Version Events after fetch/remote_refs
v2.55.0.vfs.0.10 subprocess/read_object (starts read-object.exe), then fetch/consume_refs
v2.56.0.vfs.0.0 fetch/fetch_refs, then git fetch-pack --stateless-rpc against the server. No read_object event.

Workaround

Use v2.55.0.vfs.0.10. Alternatively, run gvfs prefetch --commits after the cache server publishes a pack that contains the tip, then fetch again.

Possible fixes

The fix must keep the intent of 37a046833bb: a general no-fetch lookup must not download objects. Two options:

  • In check_exist_and_connected(), when core.virtualizeobjects or GVFS_FETCH_SKIP_REACHABILITY_AND_UPLOADPACK is set, let the ref-tip check use the read-object hook. For example, pass ODB_HAS_OBJECT_FETCH_PROMISOR for that call.
  • Skip the tip-exists check in check_exist_and_connected() under those settings and let check_connected() return early as before.

Both options need a regression test: fetch a ref whose tip is not local, with core.virtualizeobjects and a read-object hook, and check that fetch-pack does not run.

Activity

  1. tyrielv commented on Oct 12, 2026

    @tyrielv
    Author

    Johannes Schindelin (@dscho) It looks like you intentionally made this change in commit 37a046833bb during the v2.56.0-rc0 rebase. How do you think we should address this? It sounds like your change was intended to block downloading objects during a "no-fetch" request, but this is also blocking downloading objects during an explicit "git fetch"

  2. dscho commented on Oct 20, 2026

    @dscho
    Member

    Fixed via #1005

  3. dscho commented on Oct 23, 2026

    @dscho
    Member

    Tyrie Vella (@tyrielv) thank you for spelunking and digging up 37a0468.

    For historical context: That fixup! tried to address a stale multi-pack-index pointing to a removed pack: the no-fetch shortcut skipped the second local read, incorrectly reporting an object missing despite another readable packed copy. I changed it to skip only gvfs-helper, retaining local recovery and corruption reporting. I also blocked the read-object hook so missing-object enumeration would not download objects. Tests covered local recovery and missing/corrupt parents, but crucially not explicit fetch.

    All of this was triggered by GIT_TEST_COMMIT_GRAPH=1 breaking t0499 during the rebase. The graph retained the removed parent’s topology, bypassing the intended object lookup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions