Gemini doesn't work
How do I fix it?
Bdw, Gemini itself is working when the model id is correct.
Working:
gemini -m gemini-2.5-pro -o json --yolo
Failing:
gemini -m gemini-pro-2.5 -o json --yolo
But API key not working for some reason.
Okay, it started working. I asked Codex to find the issue & it figured it out.
TLDR: Gemini CLI was fine, and the model name was fine after correction. The proxy was launching Gemini in headless mode from an untrusted working directory, so Gemini exited with code 55.
Real hidden error was:
Gemini CLI is not running in a trusted directory.
Use --skip-trust or GEMINI_CLI_TRUST_WORKSPACE=true
Codex worked because it uses a different app-server path and does not hit Gemini CLI’s trusted-folder check.
Fix was adding this to Gemini extra_args:
- "--skip-trust"
Git diff for the actual fix is:
diff --git a/config.example.yaml b/config.example.yaml
@@
extra_args:
- "--yolo" # tool 자동 승인 (headless 모드 필수)
+ - "--skip-trust" # headless 실행 시 trusted folder 프롬프트 방지
diff --git a/packages/server/src/providers/gemini-provider.ts b/packages/server/src/providers/gemini-provider.ts
@@
- stdio: ['pipe', 'ignore', 'ignore'],
+ stdio: ['pipe', 'ignore', 'pipe'],
@@
trackProcess(child);
+ const stderrChunks: Buffer[] = [];
+ child.stderr?.on('data', (data: Buffer) => stderrChunks.push(data));
@@
- reject(new Error(`gemini CLI exited with code ${code}`));
+ const stderr = Buffer.concat(stderrChunks).toString('utf-8').trim();
+ const detail = stderr ? `: ${stderr}` : '';
+ reject(new Error(`gemini CLI exited with code ${code}${detail}`));
Meaning:
config.example.yaml: adds--skip-trustfor Gemini headless runs.gemini-provider.ts: stops discarding Gemini stderr, so future dashboard/API errors show the real Gemini CLI message instead of onlyexit code 55.
I also changed your local config.yaml to add --skip-trust, but config.yaml is ignored/not shown in git diff. There are other dirty files in the repo (package-lock.json, tsbuildinfo, etc.) that were already present or generated, not part of this Gemini fix.
Thanks for the detailed root-cause analysis and the diff — really appreciated. Applied your fix verbatim and pushed to main in 15d81e4:
config.example.yaml: added--skip-trustto Geminiextra_argsso new users don't hit exit code 55 in untrusted working directories.packages/server/src/providers/gemini-provider.ts: switched stderr fromignoretopipeand included the captured stderr in the rejection message, so the real Gemini CLI error (e.g. trusted-folder hint) surfaces in the dashboard/API instead of justexit code 55.
The observability gap was the bigger issue here — without the stderr fix this would have kept biting other users silently. Thanks again!