Repository navigation
Description
Describe the bug
What I am doing
In a monorepo on Windows, I stage a large number of files (100+) under a long path prefix (e.g. apps/site/vp-content/**/*.md) and run git commit --trailer "Co-authored-by: Cursor <cursoragent@cursor.com>". The pre-commit hook runs vp staged, which executes the configured task:
staged: {
'*': 'vp fmt --no-error-on-unmatched-pattern',
},What I expect
vp staged / bundled lint-staged should split the file list into chunks (Windows maxArgLength ≈ 8191) so vp fmt can run successfully across all staged files.
What actually happens
The pre-commit hook fails with a localized Windows error equivalent to "The command line is too long" (文件名太长). The commit is aborted / reverted by lint-staged.
vp staged --debug shows we are on lint-staged@17.6.2 with maxArgLength: 8191, so chunking appears configured — but a single invocation still seems to hit the Windows CreateProcess limit when many absolute paths are passed to vp fmt.
Notes
- Manual
vp fmt <directory>works fine (not an oxfmt throughput issue). - Staging ~25 files at a time succeeds; staging ~100+ fails.
- Related upstream: lint-staged#147 (Windows ARG_MAX / chunking).
- Vite+ docs /
vp staged --helpdo not expose--max-arg-length.
Possible directions
- Expose
--max-arg-length(or a safer default for absolute paths) onvp staged. - Prefer
--relativepaths when invokingvp fmtfrom staged tasks. - Document a recommended staged pattern for large monorepos / generated trees on Windows.
Reproduction
N/A — private monorepo; see Steps (Windows CreateProcess ARG_MAX with vp staged + 100+ absolute paths). Related: lint-staged/lint-staged#147
Steps to reproduce
- On Windows, clone/open a monorepo with Vite+ (
vp stagedin pre-commit). - Configure
staged: { '*': 'vp fmt --no-error-on-unmatched-pattern' }. - Modify and
git add100+ files with long paths (e.g.apps/site/vp-content/**/*.md). - Run
git commit --trailer "Co-authored-by: Cursor <cursoragent@cursor.com>" -m "test". - Observe pre-commit fail with Windows command-line-too-long (
文件名太长). - Compare:
git addonly ~25 of those files → commit succeeds. - Compare:
vp fmt apps/site/vp-content(directory arg) succeeds.
System Info
OS: Windows (win32) 10.0.26300
Node: v24.21.0
Git: 2.38.1.windows.1
Shell: PowerShell
vp --version:
vp v1.8.0
Local vite-plus:
vite-plus v1.8.0
Tools:
vite v8.3.8
rolldown v1.2.19
vitest v5.1.1
oxfmt v0.79.0
oxlint v1.94.0
tsrs v7.1.0-beta.tsrs4
tsdown v0.23.4
vp env current: unavailable via local `pnpm exec vp` (requires global vp CLI).
Additional:
lint-staged (via `vp staged --debug`): 17.6.2, maxArgLength: 8191Used Package Manager
pnpm
Logs
Validations
- Read the Contributing Guidelines.
- Check that there isn't already an issue for the same bug.
- Confirm this is a Vite+ issue and not an upstream issue (Vite, Vitest, tsdown, Rolldown, or Oxc).
- The provided reproduction is a minimal reproducible example.
Metadata
Metadata
Assignees
Type
Fields
Priority
Effort
Target date
Start date
Activity
voidzero-bot commentedon Nov 25, 2026
vp staged --relative(exposed as-r) shortens the file list passed tovp fmt, and committing in smaller batches also works. It does not affect core workflows for most users.The reported failure is specific to Windows: lint-staged (17.6.2, bundled by
vp staged) picks a per-platform chunk budget (win32→ 8191, Linux → 131072) and on Windows that budget equals the OS command-line limit exactly, leaving no headroom for quoting/escaping or any wrapper overhead in the actual spawned command line. On Linux, control runs showed lint-staged correctly splitting an 851-file staged set (346 KB of absolute paths) into chunks and running four concurrentvp fmtinvocations successfully — the chunking mechanism itself works end-to-end on the current checkout.I wasn't able to find a fix, but I identified some areas that may be relevant.
packages/cli/src/staged/bin.tspasses through a fixed allow-list of lint-staged flags but omitsmaxArgLength, andvp staged --helpdoes not expose--max-arg-length, even though upstream lint-staged supports it — so users on Windows cannot lower the 8191 budget to leave headroom for quoting overhead. As a stopgap, the already-available-r/--relativeflag (or--concurrent false) reduces command-line pressure and is documented invp staged --help. Diagnosis of the exact Windows spawn path would need a Windows host.Full Triage Report
Triage Report — Issue #3576
Title: vp staged: Windows CreateProcess fails with command line too long when many files are staged for
vp fmtStep: reproduce
Result: Skipped — host-specific (Windows-only trigger; not reproducible on the Linux runner). Control runs on Linux confirm the chunking pipeline itself works on the current checkout.
Issue summary
vp staged(bundled lint-staged) splits the staged file list so each spawnedvp fmtinvocation stays within the OS command-line limit (Windows ≈ 8191 chars).文件名太长); the commit is aborted. ~25 files at a time works;vp fmt <dir>works.vp/vite-plusv1.8.0, lint-staged 17.6.2,maxArgLength: 8191, Node v24.21.0, Windows 10.0.26300.Environment used for triage
vp --versionvp staged --debug)Why reproduction is skipped (host-specific)
The reported failure is the Windows CreateProcess/cmd.exe command-line-length limit (8191 chars). lint-staged picks the chunk budget per platform (
node_modules/.pnpm/lint-staged@17.6.2/.../lib/getMaxArgLength.js):win32→ 8191darwin→ 262144On Linux the chunk budget (131072) is far below the actual
execvelimit (~4 MB,getconf ARG_MAX= 4194304), so the OS-level failure the reporter hit cannot be triggered on this runner. The relevant interplay (shim/wrapper command line, quoting overhead on Windows vs. the exact-8191 chunk budget) only exists on Windows.Commands attempted (control evidence on Linux)
Repro:
/tmp/vite-plus-triage/gh-3576/repro/monorepo— git repo withvite.config.ts:node_modules/vite-pluslinked to the checkout viapnpm link <repo>/packages/cli.151 staged files (absolute paths, ~29 KB of argv text):
vp staged→✔ vp fmt --no-error-on-unmatched-pattern, exit 0.vp staged --debug→maxArgLength: 131072, noSplittingneeded, "Tasks were executed successfully!".851 staged files (absolute paths, 346,258 argv chars — well over the Linux chunk budget):
vp staged --debug→ exit 0. Debug log shows chunking engaged:lint-staged:getSpawnedTasks: Splitting 851 files for maxArgLength of 131072Splitting 426 files…,Splitting 425 files…→ 4 chunk invocations ofvp fmtrun concurrently (concurrency: Infinity)So the chunking mechanism (split by
command.length + 1 + files.join(' ').length <= maxArgLength) functions correctly end-to-end with the current checkout on Linux, including multiple concurrentvp fmtinvocations on chunked subsets.Additional observations (confirming reporter's notes)
vp staged --helpdoes not expose--max-arg-length; upstream lint-staged's own CLI does (lib/cli.js:maxArgLength: parseBoolOrNumber(values['max-arg-length'])).packages/cli/src/staged/bin.tspasses through a fixed flag list (allowEmpty,debug,relative, …) but notmaxArgLength, so vite-plus users cannot override the platform default of 8191 on Windows.-r, --relative(pass relative filepaths to tasks) is exposed and passed through — a partial mitigation already available on the current checkout.tinyexecexec(cmd, [...args, ...files])with no shell; the chunk length it measures is the unquotedcommand + ' ' + files.join(' '), while the real Windows command line also carries quoting/escaping and wrapper overhead — relevant headroom to examine during diagnosis on Windows, where the budget equals the OS limit exactly.cmd.exewrapper interplay) could not be observed directly.Result
host-specific(requires Windows).vp stagedchunked and ranvp fmtsuccessfully for both 151-file and 851-file staged sets with long absolute paths (exit 0).This report was made by an LLM. The analysis may be wrong, and the potential fix might not work, but is intended as a starting point for exploring the issue.