Session-start hook reports "The Vercel CLI is not installed" on Windows — execFileSync on vercel.cmd throws EINVAL
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 76/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- node.js, typescript
- 領域
- tooling
調査の方向性
hooks/src/session-start-profiler.mts の checkVercelCli から始め、実行される hooks/session-start-profiler.mjs と比較します。Windows の最小再現を実行し、近くにある npm view 呼び出しを調べて、同じ spawning パターンになっているか確認します。Windows で npm によってインストールされた .cmd および .bat の CLI が検出され、session-start hook がインストール済みの CLI を見つからないものとして報告しなくなれば完了です。
索引モデルが issue の本文から書いたものです。
説明
What happened
On Windows the session-start hook always injects this into the agent's context:
IMPORTANT: The Vercel CLI is not installed.
Strongly recommend the user install it withnpm i -g vercelto unlock agentic features likevercel env pull,vercel deploy, andvercel logs.
The CLI is installed and authenticated:
$ vercel --version
Vercel CLI 56.5.0
$ vercel whoami
<my username>
The practical cost is not the wrong line, it's what the agent does with it: it takes the statement at face value and avoids vercel ls / vercel inspect for the rest of the session, so it can't check its own deployments.
Environment
- Plugin:
vercel0.48.0 (installed fromanthropics/claude-plugins-official) - OS: Windows 11
- Node: v24.13.0
vercelinstalled globally with npm, so it resolves to%APPDATA%\npm\vercel.cmd
Cause
In hooks/src/session-start-profiler.mts (and identically in the compiled hooks/session-start-profiler.mjs that actually runs):
checkVercelCli()(~line 416) resolves the binary correctly.resolveBinaryFromPathdoes append the Windows executable extensions and findsvercel.cmd, so this part is not the bug.- It then calls
execFileSync(vercelBinary, ["--version"])at ~line 425 withoutshell: true. - Since Node 18.20 / 20.12 (the CVE-2024-27980 hardening), spawning a
.cmdor.batwithout a shell throwsEINVAL. - The
catchat ~line 433 swallows it and returns{ installed: false }— which is what produces the message.
So the hook finds the CLI and then concludes it does not exist.
Minimal repro
node -e "const{execFileSync}=require('child_process');const p=require('path').join(process.env.APPDATA,'npm','vercel.cmd');try{execFileSync(p,['--version'],{stdio:['ignore','pipe','ignore']});console.log('ok')}catch(e){console.log(e.code)}"
Prints EINVAL. Adding shell: true (with the path quoted) makes it print ok.
Blast radius
- The
npm viewcall at ~line 449 has exactly the same shape and would fail the same way, but it is unreachable: thecatchon the first call returns before it. - The "CLI is outdated (x → y)" branch lives in the
elseofinstalled, so on Windows it can never fire. Windows users don't get a false statement there — they get no upgrade notice at all. - Any npm-installed CLI on Windows resolves to a
.cmdshim, so the pattern isn't specific tovercel.
Suggested fix
Spawn through a shell on Windows when the resolved path ends in .cmd / .bat, or resolve to the JS entry point behind the shim instead of the shim itself. A bare shell: true needs care with argument escaping, so quoting the resolved path explicitly is probably the safer form.
- 主要言語
- TypeScript
- スター
- 309
- フォーク
- 68
- 平均マージ
- 1日 3時間
- マージ済み PR(30日)
- 113
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
vercel/vercel-plugin のほかの issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
vercel/vercel-plugin#313 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
vercel/vercel-plugin#312 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
vercel/vercel-plugin#311 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 半日 初心者へのやさしさ 78/100
vercel/vercel-plugin#199 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 90/100
vercel/vercel-plugin#182 ·
メンテナーはふだん 1 日以内に返信
vercel/vercel-plugin の issue をすべて見る
似ている issue
-
[Android] Nested transforms are composed in reverse order対応中かも @Danyalo が今日担当しました。 オープンRepro provided
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
software-mansion/react-native-svg#3090 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
radix-ui/primitives#4228 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 1/5 1時間未満 初心者へのやさしさ 95/100
rocketride-org/rocketride-server#2705 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
archon-ready archon-size-s archon-type-bug area: web
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
coleam00/Archon#4707 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
HarperFast/grafana-datasource#177 ·