Skip to content

failed to parse commit / failed to read tree / failed to reset the working copy #8511

@Zoybean

Description

@Zoybean

Description

Local git repository unusable after jj git fetch. I was unable to do anything until I deleted the local .git and .jj and started over from a remote.

Steps to Reproduce the Problem

Unfortunately, this is another issue where I have no clear steps to consistently reproduce, but I do have the steps I followed in order (though likely interspersed by working copy changes and various commands like jj status):

  • via git:
    • delete all (2) remotes
    • add 1 remote
  • possibly ran git fetch (unsure)
  • jj git fetch and/or jj git fetch -b some-branch --remote origin
  • jj new a recently fetched commit

Expected Behaviour

working copy commit created from the specified commit

Actual Behaviour

Internal error: Failed to reset the working copy
Caused by:
1: Internal error
2: Object d297b7181ee0e69e5a841db3b50c34757f0109d9 of type tree not found
3: An object with id d297b7181ee0e69e5a841db3b50c34757f0109d9 could not be found

I made a backup of the corrupted git repo, then deleted .git and .jj and recreated them from a fresh clone, which thankfully resolved the issue, but I did lose some local work.

I have since tried a few operations on the broken backup.
Almost all jj operations fail past this point, including things like jj op log and jj bookmark list. I've only found jj root to work so far. Therefore, I can confirm that the corruption did not start before the jj git fetch above, which succeeded.

many (but not all) git commands also fail:

  • git log succeeds.
  • git fetch succeeds
  • git status: error: bad tree object HEAD
  • git checkout HEAD~: fatal: unable to parse commit 6779d787ce5811396e31d9657e9cd9d99e7cd887 - commit mentioned is HEAD commit.
  • git reset --hard origin/main: fatal: unable to read tree 5d85f81c44dd48f4c9c049a5560892c87b08792c - commit mentioned is origin/main commit.
  • git checkout --force origin/main fails, but does move HEAD: error: Could not read 1bec222c187e3b8dee29687a3ad60ed385802d5e
  • git gc: fatal: bad tree object d297b7181ee0e69e5a841db3b50c34757f0109d9
  • git fsck: a whole lot of broken link from commit to tree, missing tree, dangling commit, and dangling blob

so it really does seem like the local history is totally bricked.

Specifications

  • Platform: Windows 11
  • Version: jj 0.36.0-c5620e6c44737d74fc206ed6c54299b720127701

My jj version was built from my branch https://github.com/Zoybean/jj/tree/list-untracked, so I recognise that adds an element of uncertainty, however the operation it adds performs no modification to the repository data.

Metadata

Metadata

Assignees

No one assigned

    Labels

    🐛bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions