jj icon indicating copy to clipboard operation
jj copied to clipboard

Frequent errors: `The working copy is stale`

Open 9999years opened this issue 4 months ago • 4 comments

Description

jj seems to spontaneously decide that the working copy is stale, usually resulting in a conflicted commit.

$ jj
Error: The working copy is stale (not updated since operation 4b3dcfa84d99).
Hint: Run `jj workspace update-stale` to update it.
See https://jj-vcs.github.io/jj/latest/working-copy/#stale-working-copy for more information.
$ jj workspace update-stale
Concurrent modification detected, resolving automatically.
Working copy  (@) now at: ossnxxrt?? 2d615b8d (no description set)
Parent commit (@-)      : rkqmuqko 2bd52f08 (no description set)
Added 0 files, modified 1 files, removed 0 files
Updated working copy to fresh commit 2d615b8dbc23

Frequently occurs with #7530 (Could not acquire lock for index file ... The lockfile at '.git/index.lock' might need manual deletion).

I'm not sure what causes this, but I'm pretty sure there's a bug; I just fixed this, resolved the conflicted commit it created, and then ran jj twice, and the second invocation errored out with The working copy is stale.

Like #7530, I feel like this must be related to something my editor's doing, but I don't know where to start debugging it. Any pointers would be appreciated.

Specifications

  • Platform: macOS Tahoe 26.0
  • Version: jj 0.33.0

9999years avatar Sep 17 '25 22:09 9999years

I'm pretty sure this is a bug in our watchman handling. Also related https://github.com/jj-vcs/jj/issues/6830. You're getting stale working copies because the watchman-based snapshots race each other.

PhilipMetzger avatar Sep 17 '25 22:09 PhilipMetzger

I suspect it is watchman related; in my case, I'm hitting this and it refuses to update!

$ jj status
Error: The working copy is stale (not updated since operation 074c4888806b).
Hint: Run `jj workspace update-stale` to update it.
See https://docs.jj-vcs.dev/latest/working-copy/#stale-working-copy for more information.
$ jj debug watchman status
Error: The working copy is stale (not updated since operation 074c4888806b).
Hint: Run `jj workspace update-stale` to update it.
See https://docs.jj-vcs.dev/latest/working-copy/#stale-working-copy for more information.
$ jj workspace update-stale
Error: The working copy is stale (not updated since operation 074c4888806b).
Hint: Run `jj workspace update-stale` to update it.
See https://docs.jj-vcs.dev/latest/working-copy/#stale-working-copy for more information.
$ jj workspace update-stale
Error: The working copy is stale (not updated since operation 074c4888806b).
Hint: Run `jj workspace update-stale` to update it.
See https://docs.jj-vcs.dev/latest/working-copy/#stale-working-copy for more information.
$ pkill watchman
$ jj workspace update-stale
Error: The working copy is stale (not updated since operation 074c4888806b).
Hint: Run `jj workspace update-stale` to update it.
See https://docs.jj-vcs.dev/latest/working-copy/#stale-working-copy for more information.
$ ps aux | grep watchman
kivikakk         45334   0.0  0.0 410060320    576 s004  S+    5:52PM   0:00.00 /nix/store/1r5p3mwlq9m50yvcdaf64xdv7v5gq581-gnugrep-3.12/bin/grep --color=auto watchman
$ jj workspace update-stale
Error: The working copy is stale (not updated since operation 074c4888806b).
Hint: Run `jj workspace update-stale` to update it.
See https://docs.jj-vcs.dev/latest/working-copy/#stale-working-copy for more information.

I tried some options to no avail;

$ jj workspace update-stale --ignore-working-copy
Error: This command must be able to update the working copy.
Hint: Don't use --ignore-working-copy.
$ jj workspace update-stale --debug
2025-12-09T06:53:49.185069Z  INFO jj_cli::cli_util: debug logging enabled
Error: The working copy is stale (not updated since operation 074c4888806b).
Hint: Run `jj workspace update-stale` to update it.
See https://docs.jj-vcs.dev/latest/working-copy/#stale-working-copy for more information.

Funny one!

kivikakk avatar Dec 09 '25 06:12 kivikakk

Which jj version? There was a range of commits between #7895 and #8154 where this would happen in colocated workspaces. Those we unreleased versions, though, so if you're on e.g. 0.35 or 0.36, then what you're seeing would be another problem.

martinvonz avatar Dec 09 '25 07:12 martinvonz

I am indeed between those PRs on a colocated workspace! I'll update and report back if it recurs, but I'm assuming it won't.

kivikakk avatar Dec 09 '25 09:12 kivikakk