Skip to content

FileNotFoundError on Windows due to missing .cmd extension in gcloud command #14

@josendfa

Description

@josendfa

What happened?

When running agents-cli setup --workspace on Windows, the CLI crashes with a FileNotFoundError when attempting to check the Application Default Credentials (ADC).

This occurs because the script calls subprocess.run(["gcloud", ...]). On Windows, the Google Cloud CLI executable is named gcloud.cmd. Python's subprocess on Windows does not automatically resolve the .cmd extension without shell=True, causing it to fail to find the executable.

Steps to Reproduce

  1. Install agents-cli (v0.1.3) on a Windows 11 environment.
  2. Ensure the Google Cloud CLI (gcloud) is installed and authenticated.
  3. Run agents-cli setup --workspace
  4. See error.

What did you expect to happen?

The CLI should successfully detect the local gcloud installation, verify authentication, and continue the setup process.

Client information

Client Information

CLI version: 0.1.3
CLI install path: C:\Users\redacted\AppData\Roaming\uv\tools\google-agents-cli\Lib\site-packages\google\agents\cli
OS info: Windows-11-10.0.26200-SP0
Installed skills: 7 (project)

  • google-agents-cli-adk-code
  • google-agents-cli-deploy
  • google-agents-cli-eval
  • google-agents-cli-observability
  • google-agents-cli-publish
  • google-agents-cli-scaffold
  • google-agents-cli-workflow

Project root: C:\Development\example-agent-1
Project name: example-agent-1
Deployment target: agent_runtime
Agent directory: app
Region: us-east1

Command Output / Logs

  1. Authentication
    ─────────────────
    agents-cli v0.1.3
    Traceback (most recent call last):
    File "C:\Users\redacted\AppData\Roaming\uv\tools\google-agents-cli\Lib\site-packages\google\agents\cli\main.py", line 64, in invoke
    super().invoke(ctx)

File "C:\Users\redacted\AppData\Roaming\uv\tools\google-agents-cli\Lib\site-packages\click\core.py", line 1902, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
File "C:\Users\redacted\AppData\Roaming\uv\tools\google-agents-cli\Lib\site-packages\click\core.py", line 1298, in invoke
return ctx.invoke(self.callback, **ctx.params)
~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\redacted\AppData\Roaming\uv\tools\google-agents-cli\Lib\site-packages\click\core.py", line 853, in invoke
return callback(*args, **kwargs)
File "C:\Users\redacted\AppData\Roaming\uv\tools\google-agents-cli\Lib\site-packages\google\agents\cli\setup\cmd_setup.py", line 326, in cmd_setup
authed, display = is_authenticated()
~~~~~~~~~~~~~~~~^^
File "C:\Users\redacted\AppData\Roaming\uv\tools\google-agents-cli\Lib\site-packages\google\agents\cli\auth.py", line 366, in is_authenticated
if not _check_valid_adc():
~~~~~~~~~~~~~~~~^^
File "C:\Users\redacted\AppData\Roaming\uv\tools\google-agents-cli\Lib\site-packages\google\agents\cli\auth.py", line 382, in _check_valid_adc
subprocess.run(
~~~~~~~~~~~~~~^
["gcloud", "auth", "application-default", "print-access-token", "--quiet"],
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
check=True,
^^^^^^^^^^^
capture_output=True,
^^^^^^^^^^^^^^^^^^^^
)
^
File "C:\Users\redacted\AppData\Roaming\uv\python\cpython-3.14-windows-x86_64-none\Lib\subprocess.py", line 555, in run
with Popen(*popenargs, **kwargs) as process:
~~~~~^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\redacted\AppData\Roaming\uv\python\cpython-3.14-windows-x86_64-none\Lib\subprocess.py", line 1039, in init
self._execute_child(args, executable, preexec_fn, close_fds,
~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pass_fds, cwd, env,
^^^^^^^^^^^^^^^^^^^
...<5 lines>...
gid, gids, uid, umask,
^^^^^^^^^^^^^^^^^^^^^^
start_new_session, process_group)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\redacted\AppData\Roaming\uv\python\cpython-3.14-windows-x86_64-none\Lib\subprocess.py", line 1553, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
# no special security
^^^^^^^^^^^^^^^^^^^^^
...<4 lines>...
cwd,
^^^^
startupinfo)
^^^^^^^^^^^^
FileNotFoundError: [WinError 2] The system cannot find the file specified

Anything else we need to know?

Workaround:

As a local workaround, changing "gcloud" to "gcloud.cmd" on google/agents/cli/auth.py successfully resolves the issue.

A permanent, cross-platform fix in the codebase could involve using shutil.which("gcloud") to resolve the correct executable path dynamically, or explicitly appending .cmd if sys.platform == 'win32'.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions