gemini-cli icon indicating copy to clipboard operation
gemini-cli copied to clipboard

Pasting certain errors into Gemini CLI so it can debug them breaks the experience

Open LyalinDotCom opened this issue 1 year ago • 5 comments

What happened?

My nextjs web app has an error like this after gemini app makes some code changes

`Error: ./src/components/city-canvas.tsx:856:1 Parsing ecmascript source code failed   854 | }   855 | attempts++; > 856 | . }   | ^   857 |   858 | if (path) {   859 | const spawnPos = path[0].clone();

Expression expected at BuildError (https://9000-firebase-studio-1751735451413.cluster-f4iwdviaqvc2ct6pgytzw4xqy4.cloudworkstations.dev/next/static/chunks/%5Broot-of-the-server%5D__e2c08166..js:17395:41) at renderWithHooks (https://9000-firebase-studio-1751735451413.cluster-f4iwdviaqvc2ct6pgytzw4xqy4.cloudworkstations.dev/_next/static/chunks/node_modules_react-dom_cjs_react-dom_development_ab7e073c.js:13260:28) at updateFunctionComponent (https://9000-firebase-studio-1751735451413.cluster-f4iwdviaqvc2ct6pgytzw4xqy4.cloudworkstations.dev/_next/static/chunks/node_modules_react-dom_cjs_react-dom_development_ab7e073c.js:16755:32) at beginWork (https://9000-firebase-studio-1751735451413.cluster-f4iwdviaqvc2ct6pgytzw4xqy4.cloudworkstations.dev/_next/static/chunks/node_modules_react-dom_cjs_react-dom_development_ab7e073c.js:18388:32) at beginWork$1 (https://9000-firebase-studio-1751735451413.cluster-f4iwdviaqvc2ct6pgytzw4xqy4.cloudworkstations.dev/_next/static/chunks/node_modules_react-dom_cjs_react-dom_development_ab7e073c.js:23101:28) at performUnitOfWork (https://9000-firebase-studio-1751735451413.cluster-f4iwdviaqvc2ct6pgytzw4xqy4.cloudworkstations.dev/_next/static/chunks/node_modules_react-dom_cjs_react-dom_development_ab7e073c.js:22402:24) at workLoopSync (https://9000-firebase-studio-1751735451413.cluster-f4iwdviaqvc2ct6pgytzw4xqy4.cloudworkstations.dev/_next/static/chunks/node_modules_react-dom_cjs_react-dom_development_ab7e073c.js:22331:17) at renderRootSync (https://9000-firebase-studio-1751735451413.cluster-f4iwdviaqvc2ct6pgytzw4xqy4.cloudworkstations.dev/_next/static/chunks/node_modules_react-dom_cjs_react-dom_development_ab7e073c.js:22308:21) at performConcurrentWorkOnRoot (https://9000-firebase-studio-1751735451413.cluster-f4iwdviaqvc2ct6pgytzw4xqy4.cloudworkstations.dev/_next/static/chunks/node_modules_react-dom_cjs_react-dom_development_ab7e073c.js:21732:84) at workLoop (https://9000-firebase-studio-1751735451413.cluster-f4iwdviaqvc2ct6pgytzw4xqy4.cloudworkstations.dev/next/static/chunks/node_modules_3bfdc6a4..js:291:48) at flushWork (https://9000-firebase-studio-1751735451413.cluster-f4iwdviaqvc2ct6pgytzw4xqy4.cloudworkstations.dev/next/static/chunks/node_modules_3bfdc6a4..js:270:28) at MessagePort.performWorkUntilDeadline (https://9000-firebase-studio-1751735451413.cluster-f4iwdviaqvc2ct6pgytzw4xqy4.cloudworkstations.dev/next/static/chunks/node_modules_3bfdc6a4..js:498:35)`

I write "im getting this error: " and try to paste in the error, this breaks the Gemini CLI experience, this is what happens:

` accepting edits (shift + tab to toggle) ╭───────────────────────────────────────────────────────────────────────────────────────╮ │ > Now i get a build error: │ ╰───────────────────────────────────────────────────────────────────────────────────────╯

~/studio (master*) no sandbox (see /docs) gemini-2.5-pro (92% context left)

file:///home/user/.global_modules/lib/node_modules/@google/gemini-cli/node_modules/ink/build/hooks/use-input.js:73 if (input.startsWith('\u001B')) { ^

TypeError: Cannot read properties of undefined (reading 'startsWith') at EventEmitter.handleData (file:///home/user/.global_modules/lib/node_modules/@google/gemini-cli/node_modules/ink/build/hooks/use-input.js:73:23) at EventEmitter.emit (node:events:536:35) at ReadStream.handleReadable (file:///home/user/.global_modules/lib/node_modules/@google/gemini-cli/node_modules/ink/build/components/App.js:137:40) at ReadStream.emit (node:events:524:28) at emitReadable_ (node:internal/streams/readable:834:12) at process.processTicksAndRejections (node:internal/process/task_queues:81:21)

Node.js v20.19.0 ^[[39m }^[[0m ^[[0m ^[[90m 855 |^[[39m attempts^[[33m++^[[39m^[[33m;^[[39mstudio-9323438643:~/studio{master}$ 0m 854 |m }m ^[[0m ^[[0m^[[31m^[[1m>^[[22m^[[39m^[[90m 856 |^[[39m ^[[33m.^[[39m }^[[0m ^[[0m ^[[90m |^[[39m ^[[31m^[[1m^^[[22m^[[39m^[[0m ^[[0m ^[[90m 857 |^[[39m^[[0m ^[[0m ^[[90m 858 |^[[39m ^[[36mifbash: m: command not found ^[[39m (path) {^[[0m ^[[0m ^[[90m 859 |^[[39m ^[[36mconst^[[39m spawnPos ^[[33m=^[[39m path[^[[35m0^[[39m]^[[33m.^[[39mclone()^[[33m;^[[39m^[[0m

Expression expected at BuildError (https://9000-firebase-studio-1751735451413.cluster-f4iwdviaqvc2ct6pgytzw4xqy4.cloudworkstations.dev/next/static/chunks/%5Broot-of-the-server%5D__e2c08166..js:17395:41) at renderWithHooks (https://9000-firebase-studio-1751735451413.cluster-f4iwdviaqvc2ct6pgytzw4xqy4.cloudworkstations.dev/_next/statibash: 0m: command not found c/chunks/node_modules_react-dom_cjs_react-dom_development_ab7e073c.js:13260:28) at updateFunctionComponent (https://9000-firebase-studio-1751735451413.cluster-f4iwdviaqvc2ct6pgytzw4xqy4.cloudworkstations.dev/_next/static/chunks/node_modules_react-dom_cjs_react-dom_development_ab7e073c.js:16755:3studio-9323438643:~/studio{master}$ m 0m 855 |m attemptsm++mm;mm 2) at beginWork (https://9000-firebase-studio-1751735451413.cluster-f4iwdviaqvc2ct6pgytzw4xqy4.cloudworkstations.dev/_next/static/chunks/node_modules_react-dom_cjs_react-dom_development_ab7e073c.js:18388:32) at beginWork$1 (https://9000-firebase-studio-1751735451413.cluster-f4iwdviaqvc2ct6pgytzw4xqy4.cloudworkstations.dev/_next/static/chunks/node_modules_react-dom_cjs_react-dom_development_ab7e073c.js:23101:28) at performUnitOfWork (https://9000-firebase-studio-1751735451413.cluster-f4iwdviaqvc2ct6pgytzw4xqy4.cloudworkstations.dev/_next/static/chunks/node_modules_react-dom_cjs_react-dom_development_ab7e073c.js:22402:24) at workLoopSync (https://9000-firebase-studio-1751735451413.cluster-f4iwdviaqvc2ct6pgytzw4xqy4.cloudworkstations.dev/_next/static/chunks/node_modules_react-bash: m: command not found dom_cjs_react-dom_development_ab7e073c.js:22331:17) at renderRootSync (https://9000-firebase-studio-1751735451413.cluster-f4iwdviaqvc2ct6pgytzw4xqy4.cloudworkstations.dev/_next/static/chunks/node_modules_react-dom_cjs_react-dom_development_ab7e073c.js:22308:21) at performConcurrentWorkOnRoot (https://9000-firebase-studio-1751735451413.cluster-f4iwdviaqvc2ct6pgytzw4xqy4.cloudworkstations.dev/_next/static/chunks/node_modules_react-dom_cjs_react-dom_development_ab7e073c.js:21732:84) at workLoop (https://9000-firebase-studio-1751735451413.cluster-f4iwdviaqvc2ct6pgytzw4xqy4.cloudworkstations.dev/next/static/chunks/node_modules_3bfdc6a4..js:291:48) at flushWork (https://9000-firebase-studio-1751735451413.cluster-f4iwdviaqvc2ct6pgytzw4xqy4.cloudworkstations.dev/next/static/chunks/node_modules_3bfdc6a4..js:270:28) at MessagePort.performWorkUntilDeadline (https://9000-firebash: m: command not found base-studio-1751735451413.cluster-f4iwdviaqvc2ct6pgytzw4xqy4.cloudworkstations.dev/next/static/chunks/node_modules_3bfdc6a4..js:498:35)^[[201~mm is not installed, but available in package mm, press [Enter] to run it, Ctrl+C to cancel.

these 9 paths will be fetched (2.82 MiB download, 16.55 MiB unpacked): /nix/store/l73xk6nylpn0dq81dkbss71lk8ikwqqn-ed-1.20.2 /nix/store/19djhxh07c8ya6n96ylidaxgi35p8asx-file-5.45 /nix/store/h42gyp46whkbfsl4c6ayn06db4jc3l8f-gnu-config-2024-01-01 /nix/store/gvc67j3hwsyz6bd2g9gfr80l1r6n3khm-gnumake-4.4.1 /nix/store/5al76avydzvbjldbd29lpaqqk6x7iwl6-mm-2020.11.17 /nix/store/1ljh6ska2p266gwhqrnl8znnczb7651d-patch-2.7.6 /nix/store/q3hmrfgjkba7vqyrvr1nlsaiymy1ma5w-patchelf-0.15.0 /nix/store/8rb50qg3macvs6y7i0fll37nsw2sifyc-stdenv-linux /nix/store/hi361xvwkvh3nrqgr6bzrnr39rw2g6yp-update-autotools-gnu-config-scripts-hook copying path '/nix/store/h42gyp46whkbfsl4c6ayn06db4jc3l8f-gnu-config-2024-01-01' from 'https://cache.nixos.org' to 'local-overlay://'... copying path '/nix/store/5al76avydzvbjldbd29lpaqqk6x7iwl6-mm-2020.11.17' from 'https://cache.nixos.org' to 'local-overlay://'... copying path '/nix/store/gvc67j3hwsyz6bd2g9gfr80l1r6n3khm-gnumake-4.4.1' from 'https://cache.nixos.org' to 'local-overlay://'... copying path '/nix/store/l73xk6nylpn0dq81dkbss71lk8ikwqqn-ed-1.20.2' from 'https://cache.nixos.org' to 'local-overlay://'... copying path '/nix/store/19djhxh07c8ya6n96ylidaxgi35p8asx-file-5.45' from 'https://cache.nixos.org' to 'local-overlay://'... copying path '/nix/store/q3hmrfgjkba7vqyrvr1nlsaiymy1ma5w-patchelf-0.15.0' from 'https://cache.nixos.org' to 'local-overlay://'... copying path '/nix/store/1ljh6ska2p266gwhqrnl8znnczb7651d-patch-2.7.6' from 'https://cache.nixos.org' to 'local-overlay://'... copying path '/nix/store/hi361xvwkvh3nrqgr6bzrnr39rw2g6yp-update-autotools-gnu-config-scripts-hook' from 'https://cache.nixos.org' to 'local-overlay://'... copying path '/nix/store/8rb50qg3macvs6y7i0fll37nsw2sifyc-stdenv-linux' from 'https://cache.nixos.org' to 'local-overlay://'... 2025/07/06 20:22:34 Unable to login: contents=[123 34 101 114 114 99 111 100 101 34 58 34 77 95 66 65 68 95 74 83 79 78 34 44 34 101 114 114 111 114 34 58 34 74 83 79 78 32 102 105 101 108 100 115 32 97 114 101 32 110 111 116 32 118 97 108 105 100 34 125] msg=Failed to POST JSON to /_matrix/client/r0/login code=400 wrapped=M_BAD_JSON: JSON fields are not valid 2025/07/06 20:22:34 contents=[123 34 101 114 114 99 111 100 101 34 58 34 77 95 77 73 83 83 73 78 71 95 84 79 75 69 78 34 44 34 101 114 114 111 114 34 58 34 77 105 115 115 105 110 103 32 97 99 99 101 115 115 32 116 111 107 101 110 34 125] msg=Failed to POST JSON to /_matrix/client/r0/logout code=401 wrapped=M_MISSING_TOKEN: Missing access token To permanently add this package to your environment, please add pkgs.mm to the list of packages in your dev.nix file, then rebuild your environment studio-9323438643:~/studio{master}$ 2) bash: syntax error near unexpected token )' studio-9323438643:~/studio{master}$ at beginWork (https://9000-firebase-studio-1751735451413.cluster-f4iwdviaqvc2ct6pgytzw4xqy4.cloudworkstations.dev/_next/static/chunks/node_modules_react-dom_cjs_react-dom_development_ab7e073c.js:18388:32) bash: syntax error near unexpected token (' studio-9323438643:~/studio{master}$ at beginWork$1 (https://9000-firebase-studio-1751735451413.cluster-f4iwdviaqvc2ct6pgytzw4xqy4.cloudworkstations.dev/_next/static/chunks/node_modules_react-dom_cjs_react-dom_development_ab7e073c.js:23101:28) bash: syntax error near unexpected token (' studio-9323438643:~/studio{master}$ at performUnitOfWork (https://9000-firebase-studio-1751735451413.cluster-f4iwdviaqvc2ct6pgytzw4xqy4.cloudworkstations.dev/_next/static/chunks/node_modules_react-dom_cjs_react-dom_development_ab7e073c.js:22402:24) bash: syntax error near unexpected token (' studio-9323438643:~/studio{master}$ at workLoopSync (https://9000-firebase-studio-1751735451413.cluster-f4iwdviaqvc2ct6pgytzw4xqy4.cloudworkstations.dev/_next/static/chunks/node_modules_react-dom_cjs_react-dom_development_ab7e073c.js:22331:17) bash: syntax error near unexpected token (' studio-9323438643:~/studio{master}$ at renderRootSync (https://9000-firebase-studio-1751735451413.cluster-f4iwdviaqvc2ct6pgytzw4xqy4.cloudworkstations.dev/_next/static/chunks/node_modules_react-dom_cjs_react-dom_development_ab7e073c.js:22308:21) bash: syntax error near unexpected token (' studio-9323438643:~/studio{master}$ at performConcurrentWorkOnRoot (https://9000-firebase-studio-1751735451413.cluster-f4iwdviaqvc2ct6pgytzw4xqy4.cloudworkstations.dev/_next/static/chunks/node_modules_react-dom_cjs_react-dom_development_ab7e073c.js:21732:84) bash: syntax error near unexpected token (' studio-9323438643:~/studio{master}$ at workLoop (https://9000-firebase-studio-1751735451413.cluster-f4iwdviaqvc2ct6pgytzw4xqy4.cloudworkstations.dev/_next/static/chunks/node_modules_3bfdc6a4._.js:291:48) bash: syntax error near unexpected token (' studio-9323438643:~/studio{master}$ at flushWork (https://9000-firebase-studio-1751735451413.cluster-f4iwdviaqvc2ct6pgytzw4xqy4.cloudworkstations.dev/next/static/chunks/node_modules_3bfdc6a4..js:270:28) bash: syntax error near unexpected token (' studio-9323438643:~/studio{master}$ at MessagePort.performWorkUntilDeadline (https://9000-firebase-studio-1751735451413.cluster-f4iwdviaqvc2ct6pgytzw4xqy4.cloudworkstations.dev/_next/static/chunks/node_modules_3bfdc6a4._.js:498:35)~ bash: syntax error near unexpected token (' studio-9323438643:~/studio{master}$ `

Im basically kicked out of gemini CLI after the paste back into shell.

What did you expect to happen?

Other CLIs can handle pasting in these kind of errors with issues so i can just type "this is an error im getting: ", paste the error and hit enter to send to CLI to get help

Client information

I cannot provide console about from gemini /about as this does not seem ot be a valid command

$ gemini /about
# paste output here

Login information

Using Gemini CLI key

Anything else we need to know?

I've run into this many times before but the most recent one from this report was inside of Firebase Studio code view using terminal there.

LyalinDotCom avatar Jul 06 '25 20:07 LyalinDotCom

@jacob314 any idea here? I would have thought we'd be handling any stray ansi codes

NTaylorMullen avatar Jul 07 '25 02:07 NTaylorMullen

Hitting this as well. Pasting a Next.js build error (with ANSI color codes) into the CLI causes an immediate crash.

  • OS: win32
  • CLI: 0.1.9

Looks like the raw input isn't being sanitized. The ANSI escape codes probably result in an undefined value being passed to ink, causing the startsWith TypeError. Stripping control characters from the pasted input before processing should fix it

hakonno avatar Jul 08 '25 20:07 hakonno

Im getting this too, adding flutter logs (which it asked for).

✕ [API Error: [{ "error": { "code": 400, "message": "Please ensure that the number of function response parts is equal
to the number of function call parts of the function call turn.", "errors": [ { "message": "Please ensure that the number of function response parts is equal to the number of function call parts of the function call turn.", "domain": "global", "reason": "badRequest" } ], "status": "INVALID_ARGUMENT" } } ]]

First time using CLI, 5th message..... Now won't respond at all....

╭────────────╮ │ > hello? │ ╰────────────╯

✕ [API Error: [{ "error": { "code": 400, "message": "Please ensure that the number of function response parts is equal to the number of function call parts of the function call turn.", "errors": [ { "message": "Please ensure that the number of function response parts is equal to the number of function call parts of the function call turn.", "domain": "global", "reason": "badRequest" } ], "status": "INVALID_ARGUMENT" } } ]]

Im afraid i cant post the logs themselves but they did contain emoji's, if that makes a difference?

Only way to not get this response it to quit and start again....

AimiiAI avatar Jul 09 '25 12:07 AimiiAI

The 400 error will be fixed in #6093

scidomino avatar Aug 18 '25 17:08 scidomino

This has been fixed by ansi escape support in the input prompt

jacob314 avatar Oct 14 '25 05:10 jacob314