star-cliproxy icon indicating copy to clipboard operation
star-cliproxy copied to clipboard

Gemini doesn't work

Open deadcoder0904 opened this issue 7 months ago • 4 comments

Image Image

How do I fix it?

deadcoder0904 avatar May 03 '26 14:05 deadcoder0904

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.

deadcoder0904 avatar May 03 '26 15:05 deadcoder0904

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"

deadcoder0904 avatar May 03 '26 15:05 deadcoder0904

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-trust for Gemini headless runs.
  • gemini-provider.ts: stops discarding Gemini stderr, so future dashboard/API errors show the real Gemini CLI message instead of only exit 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.

deadcoder0904 avatar May 03 '26 15:05 deadcoder0904

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-trust to Gemini extra_args so new users don't hit exit code 55 in untrusted working directories.
  • packages/server/src/providers/gemini-provider.ts: switched stderr from ignore to pipe and 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 just exit code 55.

The observability gap was the bigger issue here — without the stderr fix this would have kept biting other users silently. Thanks again!

starhunt avatar May 12 '26 01:05 starhunt