GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — `vp config` rewrites unchanged git config on every run, so concurrent runs in linked worktrees fail with "could not lock config file" · Issue #2849 · voidzero-dev/vite-plus

vp config rewrites unchanged git config on every run, so concurrent runs in linked worktrees fail with "could not lock config file" #2849

New issue
Copy link
New issue
Copy link
Closed
#2958
Closed
vp config rewrites unchanged git config on every run, so concurrent runs in linked worktrees fail with "could not lock config file"#2849
#2958
Copy link
Assignees
naokihaba
Labels
bugSomething isn't working
Milestone
RC

Description

@cmaciasjimenez
cmaciasjimenez
opened on Sep 29, 2026
Issue body actions

Describe the bug

install() in packages/cli/src/config/hooks.ts writes git config on every run, even when every value is already what it would write:

  • git config core.hooksPath <target>, even when core.hooksPath already equals <target>
  • git config --local --unset-all vp.hooks.disabled, even when the key is not set
  • git config --local vp.hooks.dir … / vp.hooks.prefix …, even when the stored values are equal

Linked worktrees share one .git/config, and each write takes git's config.lock. So two vp config runs at the same time, in different worktrees of one clone, collide and one fails:

error: could not lock config file /path/to/repo/.git/config: File exists

When the run comes from a prepare script, the package manager reports a lifecycle failure (ERR_PNPM_EXECUTOR_LIFECYCLE_SCRIPT_FAILED) and the install fails. This happens whenever worktrees are set up in parallel, for example by several coding agents that each create a worktree and install.

Reproduction

No project files needed, only a clone with a second worktree:

mkdir repro && cd repro && git init -q && git commit -q --allow-empty -m init
git worktree add -q ../repro-wt HEAD
vp config --no-agent                       # first run: sets core.hooksPath once
for i in $(seq 1 20); do
  vp config --no-agent >/dev/null 2>&1 || echo FAIL &
  (cd ../repro-wt && vp config --no-agent >/dev/null 2>&1 || echo FAIL) &
  wait
done | wc -l

On my machine this prints 18. Nothing needs to change after the first run, so the expected result is 0.

Suggested fix

Compare before writing, so a run that changes nothing never takes the lock (this keeps a relative core.hooksPath verbatim too):

 function gitConfigSet(key, value) {
+  if (gitConfigGet(key, { local: true }) === value) return { ok: true };
   ...
 }
 function gitConfigUnset(key) {
+  if (gitConfigGet(key, { local: true }) == null) return { ok: true };
   ...
 }
 // install()
-  const { status, stderr } = spawnSync('git', ['config', 'core.hooksPath', location.target]);
+  const { status, stderr } = existingHooksPath === location.target
+    ? { status: 0, stderr: '' }
+    : spawnSync('git', ['config', 'core.hooksPath', location.target]);

With this applied to the 1.0.0 dist as a local patch, 3 parallel runs × 10 rounds gave 0 failures, against 7/10 failures unpatched with 2 in parallel. A first-ever run in a clone still writes, but that happens once per clone rather than once per worktree setup.

System Info

  • vite-plus 1.0.0 (global and local)
  • git 2.55.0, macOS (Darwin 27)

Used Package Manager

pnpm (12.8.0)

Activity

  1. naokihaba
    added
    bugSomething isn't working
    on Oct 5, 2026
  2. naokihaba
    self-assigned this
    on Oct 5, 2026
  3. naokihaba
    added this to the RC milestone on Oct 5, 2026
  4. naokihaba commented on Oct 5, 2026

    @naokihaba
    naokihaba
    on Oct 5, 2026
    Collaborator
    More actions

    I was able to reproduce this on macOS using the global Vite+ 1.0.0 CLI and Node.js 24.21.0. Running vp config --no-agent concurrently across two worktrees failed 14 out of 40 times with could not lock config file, while the git config remained untouched.

    You can find the reproduction steps and logs here: https://github.com/naokihaba/vite-plus-issue-2849-repro

  5. fengmk2
    closed this as completedin 9635bccon Oct 9, 2026
  6. fengmk2
    added 2 commits that reference this issue on Oct 9, 2026

    fix(config): skip git config writes that change nothing (voidzero-dev…

    This issue will close once commit 9635bcc is merged into the 'main' branch.
    9635bcc

    chore(deps): update rust crates (#1780)

    This issue will close once commit 62de578 is merged into the 'main' branch.
    62de578
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @naokihaba
    naokihaba

Labels

bugSomething isn't working

Type

No type

Fields

Priority

None yet

Projects

No projects

    Milestone

    • RC

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.