Skip to content

Snapshot cleanup fails forever and leaks tmp_pack_* after project gc prunes shared objects #46034

Closed as not planned

Description

@arthurjd

Description

The hourly snapshot cleanup (git gc --prune=7.days) started failing with fatal: unable to read <sha> / fatal: failed to run repack and never recovered. The snapshot repo shares the project object database via objects/info/alternates (the seed() mechanism). After running git gc (history rewrite) in the project, objects the snapshot still referenced were pruned from the project object store. Every hourly gc attempt now dies on the same missing object and leaves an orphaned tmp_pack_* (~90MB each) in objects/pack/. cleanup() logs "cleanup failed" and returns without removing anything, so the repo never recovers. My snapshot folder reached 62GB: 699 tmp_pack files, 699 identical "cleanup failed" log entries, git count-objects shows garbage: 699 / size-garbage: 61.69 GiB. This is a second failure mode of the known tmp_pack leak (#14811, #10034, #8749): those report interrupted gc; this one is a deterministic, permanent failure.

Plugins

none

OpenCode version

1.18.25

Steps to reproduce

  1. Open a project and let the snapshot seed its alternates from the project .git/objects
  2. Run git gc in the project (or rewrite history / force-push) so old objects are pruned
  3. Keep an opencode session running — the hourly snapshot cleanup fails every time
  4. Check the log for repeated "cleanup failed" and count tmp_pack_* files growing in ~/.local/share/opencode/snapshot/<hash>/objects/pack/

Screenshot and/or share link

No response

Operating System

Zorin OS 18.1 (Ubuntu 24.04 based)

Terminal

GNOME Terminal (default)

Activity

  1. github-actions commented on Aug 28, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of or related to existing issues. Please check:

  2. arthurjd commented on Aug 29, 2026

    @arthurjd
    Author

    #43877 is related but not a duplicate — it's a different failure mode with a different fix:

    PR #46037 addresses this issue's mode: prune stale tmp_pack_* after every gc run (success or failure) and rebuild the snapshot store when gc fails on missing objects. It intentionally does not fire on the spawn-error case — there the store is not corrupted, so deleting it would be wrong.

  3. thdxr commented on Oct 11, 2026

    @thdxr
    Member

    Thanks for the report! OpenCode 2.0 is now out and development is focused on V2, so we're closing issues filed against OpenCode 1. Please upgrade (opencode upgrade --major, details: https://anoma.ly/notes/opencode-2-0), and if this is still relevant on 2.0, reopen this issue or open a new one with your 2.0 version.

    — from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊

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

Metadata

Metadata

Assignees

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