{"thread":{"id":"63352","subject":"bug report - BUG: builtin/pack-objects.c:4310: should_include_obj should only be called on existing objects","startedAt":"2025-04-25T18:15:06Z","lastAt":"2025-10-17T15:57:57Z","messageCount":5,"participants":["Nik Garza","Elijah Newren","Jonathan Tan","Sam Estep"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"516823","messageId":"CA+ODqj2s68nPWzd1KHH3vUm3SiFHuf2b=+hmNuWesi-bo3c8_g@mail.gmail.com","threadId":"63352","inReplyTo":null,"subject":"bug report - BUG: builtin/pack-objects.c:4310: should_include_obj should only be called on existing objects","fromName":"Nik Garza","fromEmail":"nikolas@applied.co","sentAt":"2025-04-25T18:14:53Z","receivedAt":"2025-04-25T18:15:06Z","isPatch":false,"sender":{"key":"nikolas@applied.co","avatar":null},"body":"reporting the attached bug:\n\n\n\n-- \n\n*Nikolas Garza*\n\nSoftware Engineer\n\nnikolas@applied.co\n\n(209) 499-1193\n\nApplied Intuition, Inc. <https://applied.co/>\n\n\nThank you for filling out a Git bug report!\nPlease answer the following questions to help us understand your issue.\n\nContinually hitting a oack-objects error when fetching tags in my repo. This occurs in CI during critical jobs. The issues is flaky but leads to an unreliable system.\n\nThe Error:\n\nERROR: Failed to fetch git tags from origin!\n\tStdout:\n\tStderr:\nBUG: builtin/pack-objects.c:4310: should_include_obj should only be called on existing objects\nerror: pack-objects died of signal 6\nfatal: could not finish pack-objects to repack local links\nfatal: index-pack failed\n\n\nWhat did you do before the bug happened? (Steps to reproduce your issue)\n\nran the following:\n\ngit fetch origin refs/tags/<version-identified>.*refs/tags/<version-identifier.*\n\nWhat did you expect to happen? (Expected behavior)\n\ntags to be fetched to the CI machine running this command \n\nWhat happened instead? (Actual behavior)\n\nerror above was thrown causing the job to fail\n\nWhat's different between what you expected and what actually happened?\n\npretty simple...we expect the fetch to work as expected\n\nAnything else you want to add:\n\nwe are pretty sure retries will resovle the issue but that shouldn't bne necessary. \n\nwe upgraded git from version 2.47.0 -> 2.49.0 and then started seeing the issue so we believe this is a low level git issue itself and not our use of git in our repo\n\nPlease review the rest of the bug report below.\nYou can delete any lines you don't wish to share.\n\n\n[System Info]\ngit version:\ngit version 2.49.0\ncpu: x86_64\nno commit associated with this build\nsizeof-long: 8\nsizeof-size_t: 8\nshell-path: /bin/sh\nlibcurl: 8.5.0\nzlib: 1.3\nuname: Linux 5.15.0-134-generic #145~20.04.1-Ubuntu SMP Mon Feb 17 13:27:16 UTC 2025 x86_64\ncompiler info: gnuc: 13.3\nlibc info: glibc: 2.39\n$SHELL (typically, interactive shell): <unset>\n\n\n[Enabled Hooks]\npost-checkout\npost-commit\npost-merge\npre-commit\npre-push\n"},{"id":"516824","messageId":"CABPp-BFiLURYmELQ1omyPJ+49cVxk1h4rPYj42zMwGUW-NUUGQ@mail.gmail.com","threadId":"63352","inReplyTo":"CA+ODqj2s68nPWzd1KHH3vUm3SiFHuf2b=+hmNuWesi-bo3c8_g@mail.gmail.com","subject":"Re: bug report - BUG: builtin/pack-objects.c:4310: should_include_obj should only be called on existing objects","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2025-04-25T18:30:56Z","receivedAt":"2025-04-25T18:31:08Z","isPatch":false,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"On Fri, Apr 25, 2025 at 11:15 AM Nik Garza <nikolas@applied.co> wrote:\n>\n> reporting the attached bug:\n\nWe prefer the bug be included inline rather than attached.  However,\nfrom the reported error:\n\nERROR: Failed to fetch git tags from origin!\n    Stdout:\n    Stderr:\nBUG: builtin/pack-objects.c:4310: should_include_obj should only be\ncalled on existing objects\nerror: pack-objects died of signal 6\nfatal: could not finish pack-objects to repack local links\nfatal: index-pack failed\n\nA couple quick checks shows:\n\n$ git grep \"should_include_obj should only be called on existing objects\"\nbuiltin/pack-objects.c:         BUG(\"should_include_obj should only be\ncalled on existing objects\");\n$ git log --pretty=reference -S\"should_include_obj should only be\ncalled on existing objects\" builtin/pack-objects.c\nc08589efdc5 (index-pack: repack local links into promisor packs, 2024-11-01)\n\nwhich was a commit that was released as part of v2.48.0, and as you\nsaid, this started happening after you upgraded from 2.47 -> 2.49.\nCc'ing the author of that commit for his comments.\n"},{"id":"516906","messageId":"20250428192320.3595509-1-jonathantanmy@google.com","threadId":"63352","inReplyTo":"CABPp-BFiLURYmELQ1omyPJ+49cVxk1h4rPYj42zMwGUW-NUUGQ@mail.gmail.com","subject":"Re: bug report - BUG: builtin/pack-objects.c:4310: should_include_obj should only be called on existing objects","fromName":"Jonathan Tan","fromEmail":"jonathantanmy@google.com","sentAt":"2025-04-28T19:23:20Z","receivedAt":"2025-04-28T19:23:23Z","isPatch":false,"sender":{"key":"jonathantanmy@fastmail.com","avatar":null},"body":"Elijah Newren <newren@gmail.com> writes:\n> Cc'ing the author of that commit for his comments.\n\nI took a look. I'm not sure why I made the assumption that\nshould_include_obj() would only ever be called on objects in the repo\n- in process_tree() in list-objects.c, the case of a missing object is\nhandled only after should_include_obj() is called. Looking back at the\nearliest mention of this on the list [1] I don't see any clues either.\n\nIn any case, the fix is probably to change it so that\nshould_include_obj() returns 0 if the object is absent.\n\nHaving said that, I couldn't come up with a test that exercises this\nfailure mode. Nik, do you have a minimal repo that reproduces this\nerror? If yes, if you could contribute a test in the form of the 'after\nfetching descendants of non-promisor commits, gc works' test in t5616,\nthat would help prevent regressions in the future.\n\n[1] https://lore.kernel.org/git/fb2c202591b466eea33b4585e47b70e9086603bb.1729549127.git.jonathantanmy@google.com/\n"},{"id":"516925","messageId":"CA+ODqj34b2DsvjxGgVb=jSaTUNYRh_nNtaCzCx8QiJ8QFsRecA@mail.gmail.com","threadId":"63352","inReplyTo":"20250428192320.3595509-1-jonathantanmy@google.com","subject":"Re: bug report - BUG: builtin/pack-objects.c:4310: should_include_obj should only be called on existing objects","fromName":"Nik Garza","fromEmail":"nikolas@applied.co","sentAt":"2025-04-28T22:55:05Z","receivedAt":"2025-04-28T22:55:17Z","isPatch":false,"sender":{"key":"nikolas@applied.co","avatar":null},"body":"Resending....\n\nI haven't been able to define a repro case unfortunately. The error\nsurfaces randomly in our CI infrastructure. I'll take a look at some\nof the failures we have seen and try to come up with a repro. Will add\na test if I can find something.\n\nOn Mon, Apr 28, 2025 at 12:23 PM Jonathan Tan <jonathantanmy@google.com> wrote:\n>\n> Elijah Newren <newren@gmail.com> writes:\n> > Cc'ing the author of that commit for his comments.\n>\n> I took a look. I'm not sure why I made the assumption that\n> should_include_obj() would only ever be called on objects in the repo\n> - in process_tree() in list-objects.c, the case of a missing object is\n> handled only after should_include_obj() is called. Looking back at the\n> earliest mention of this on the list [1] I don't see any clues either.\n>\n> In any case, the fix is probably to change it so that\n> should_include_obj() returns 0 if the object is absent.\n>\n> Having said that, I couldn't come up with a test that exercises this\n> failure mode. Nik, do you have a minimal repo that reproduces this\n> error? If yes, if you could contribute a test in the form of the 'after\n> fetching descendants of non-promisor commits, gc works' test in t5616,\n> that would help prevent regressions in the future.\n>\n> [1] https://lore.kernel.org/git/fb2c202591b466eea33b4585e47b70e9086603bb.1729549127.git.jonathantanmy@google.com/\n\n\n\n-- \n\nNikolas Garza\n\nSoftware Engineer\n\nnikolas@applied.co\n\n(209) 499-1193\n\nApplied Intuition, Inc.\n"},{"id":"529081","messageId":"20251017155754.1425091-1-sam@samestep.com","threadId":"63352","inReplyTo":"CA+ODqj34b2DsvjxGgVb=jSaTUNYRh_nNtaCzCx8QiJ8QFsRecA@mail.gmail.com","subject":"Re: bug report - BUG: builtin/pack-objects.c:4310: should_include_obj should only be called on existing objects","fromName":"Sam Estep","fromEmail":"sam@samestep.com","sentAt":"2025-10-17T15:57:54Z","receivedAt":"2025-10-17T15:57:57Z","isPatch":false,"sender":{"key":"sam@samestep.com","avatar":null},"body":"I hit this same bug today: https://github.com/samestep/npc/issues/6\n\nI'm using Git v2.51.0. As Nik mentioned, the issue is flaky, but I have\nbeen able to reproduce it several times today on both x86_64-linux and\naarch64-darwin via these steps:\n\n$ git clone --mirror --filter=tree:0 https://github.com/NixOS/nixpkgs.git\nCloning into bare repository 'nixpkgs.git'...\nremote: Enumerating objects: 1403208, done.\nremote: Counting objects: 100% (1204/1204), done.\nremote: Compressing objects: 100% (1164/1164), done.\nremote: Total 1403208 (delta 70), reused 273 (delta 40), pack-reused 1402004 (from 2)\nReceiving objects: 100% (1403208/1403208), 550.95 MiB | 19.74 MiB/s, done.\nResolving deltas: 100% (71770/71770), done.\nEnumerating objects: 1, done.\nCounting objects: 100% (1/1), done.\nWriting objects: 100% (1/1), done.\nTotal 1 (delta 0), reused 0 (delta 0), pack-reused 0 (from 0)\n$ cd nixpkgs.git\n$ git fetch --no-show-forced-updates\nFrom https://github.com/NixOS/nixpkgs\n - [deleted]                 (none)                 -> gh-readonly-queue/master/pr-452910-91484645881d96272b133ad577cbb314c3af446f\n - [deleted]                 (none)                 -> gh-readonly-queue/master/pr-452916-93e25250a9459a0d62e9156f06d9ab66fa081ebd\n - [deleted]                 (none)                 -> gh-readonly-queue/master/pr-452934-9347aa5ba848ac348dd123e5c6b28a5e69ebebee\n - [deleted]                 (none)                 -> refs/pull/435349/merge\n - [deleted]                 (none)                 -> refs/pull/452910/merge\n - [deleted]                 (none)                 -> refs/pull/452916/merge\n - [deleted]                 (none)                 -> refs/pull/452934/merge\nremote: Enumerating objects: 228, done.\nremote: Counting objects: 100% (228/228), done.\nremote: Compressing objects: 100% (223/223), done.\nremote: Total 228 (delta 5), reused 152 (delta 5), pack-reused 0 (from 0)\nReceiving objects: 100% (228/228), 123.31 KiB | 17.62 MiB/s, done.\nResolving deltas: 100% (5/5), done.\nBUG: builtin/pack-objects.c:4835: should_include_obj should only be called on existing objects\nerror: pack-objects died of signal 6\nfatal: could not finish pack-objects to repack local links\nfatal: index-pack failed\n\nIf the error doesn't occur immediately, it should eventually occur if\nyou keep re-running that last command:\n\n$ git fetch --no-show-forced-updates\n\nIn case it's relevant, my Git version is built from Nixpkgs commit\n82c2e0d6dde50b17ae366d2aa36f224dc19af469, and I have this in my global\nGit config:\n\n[fetch]\n\tall = true\n\tprune = true\n\nOn Mon, Apr 28, 2025 at 12:23 PM Jonathan Tan <jonathantanmy@google.com> wrote:\n> In any case, the fix is probably to change it so that\n> should_include_obj() returns 0 if the object is absent.\n\nDoes this still seem like the right approach?\n"}]}