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

Command rejected because it could not be parsed safely

Open Ikeoh opened this issue 1 month ago • 3 comments

What happened?

Recently, the tool started having trouble executing commands in PowerShell. I have already checked the PowerShell execution policies and even set them to 'Unrestricted', but it didn't solve the issue. I have tried several solutions, but I can't identify exactly what in my environment is causing this behavior. Can anyone help?

Image Image

What did you expect to happen?

The tool needs to be able to execute shell commands to create directories, files, etc.

Client information

  • CLI Version: 0.15.4
  • Git Commit: 60407daf5
  • Session ID: eb418989-2fdf-44b6-a149-2bf95eaf82be
  • Operating System: win32 v22.19.0
  • Sandbox Environment: no sandbox
  • Model Version: auto
  • Memory Usage: 203.8 MB

Login information

google account with GOOGLE_CLOUD_PROJECT

Anything else we need to know?

No response

Ikeoh avatar Nov 18 '25 12:11 Ikeoh

i am also facing same problem "rejecting shell commands cause could not be parsed safely "

M-DaniyalHS1 avatar Nov 20 '25 01:11 M-DaniyalHS1

I resolved this on Windows. It turns out the "could not be parsed safely" error was misleading in my case.

The root cause was that powershell was missing from my system Environment Variables (PATH). The CLI tries to invoke PowerShell in the background, and it failed because the command wasn't found.

I added the standard PowerShell path to my system Path variable, and the CLI works perfectly now.

Massachute avatar Dec 04 '25 03:12 Massachute

@M-DaniyalHS1 @Ikeoh If you still have this problem, I would strongly suggest using gemini cli on wsl. That helped me

gorkemgul avatar Dec 17 '25 18:12 gorkemgul

I encountered the same problem on MacOS, what should I do?

lfq0404 avatar Dec 19 '25 07:12 lfq0404