Skip to content

fix(VSearch): suppress dotenv v17 stdout banner that breaks stdio JSON protocol - #461

Merged
lioensky merged 1 commit into
lioensky:mainfrom
hackxixi:fix/vsearch-dotenv-stdout-banner
Aug 28, 2026
Merged

fix(VSearch): suppress dotenv v17 stdout banner that breaks stdio JSON protocol#461
lioensky merged 1 commit into
lioensky:mainfrom
hackxixi:fix/vsearch-dotenv-stdout-banner

Conversation

@hackxixi

Copy link
Copy Markdown
Contributor

问题 / Problem

Plugin/VSearch/package.json 声明 dotenv: ^17.4.2。dotenv v17 在 config() 时会向 stdout 打印横幅:

◇ injected env (11) from config.env // tip: ...

VSearch 与 PluginManager 走 stdio 协议、stdout 必须是纯 JSON,横幅排在 JSON 响应之前,导致每次调用都失败:

[PluginManager executePlugin Internal] Failed to parse final stdout JSON from plugin "VSearch".
Error: Unexpected token ◇, "◇ injected"... is not valid JSON

VSearch.js 自身的日志已经全部走 stderr(设计意图正确),唯一污染源就是 dotenv 的横幅。主仓库 package.json 用的是 ^16.5.0(无横幅),所以只有 VSearch 受影响。

修复 / Fix

一行改动:dotenv.config({ path: configPath, quiet: true }),恢复 v16 的静默行为。

在 Linux (node v22) 实测:修复前 stdout 首行为横幅,修复后 stdout 为纯 JSON。

…N protocol

dotenv ^17 prints a tips banner ("◇ injected env (n) from config.env ...")
to stdout on config(). VSearch communicates with PluginManager over stdio
where stdout must contain only JSON, so the banner lands before the JSON
response and every call fails with:

  Failed to parse final stdout JSON from plugin "VSearch".
  Error: Unexpected token "◇" ... is not valid JSON

VSearch.js already routes all of its own logging to stderr; this banner is
the only stdout contamination. Passing quiet: true restores the dotenv v16
behavior.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@lioensky
lioensky merged commit a45eba0 into lioensky:main Aug 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants