Analysis below was done by Claude (Anthropic, via Claude Code) while debugging this on my machine. Filing as-is — not claiming credit for the investigation.
What happened?
On a fresh Windows 11 install, uvx google-agents-cli setup crashes with UnicodeEncodeError: 'charmap' codec can't encode characters in position 1-3 before reaching any setup logic. The crash happens inside _print_logo() at setup/cmd_setup.py:41 because the logo is drawn with Unicode block characters (█ ▀ ▄, U+2588 / U+2580 / U+2584), and Python on Windows defaults to writing stdout through the legacy cp1252 codepage, which has no glyphs for those characters.
This is independent of #14. After working around #14 (or installing without gcloud needing to be called), this bug still prevents setup from running unless the user happens to know to set PYTHONUTF8=1. For a "getting started" command, that's a hard wall on Windows.
Steps to Reproduce
- Fresh Windows 11 PowerShell session, no
PYTHONUTF8 set.
uvx google-agents-cli setup
- Crash before the logo prints, before any setup work begins.
What did you expect to happen?
setup should print the logo (or a non-fancy fallback) and proceed.
Workaround
$env:PYTHONUTF8 = "1"
uvx google-agents-cli setup
or permanently: [Environment]::SetEnvironmentVariable("PYTHONUTF8", "1", "User").
Suggested fix
Two options, in order of preference:
1. Reconfigure stdio at CLI entry. Near the top of main.py, before any click.secho runs:
import sys
if sys.platform == "win32":
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
sys.stderr.reconfigure(encoding="utf-8", errors="replace")
This fixes the logo and any future Unicode-bearing output. The codebase already prints non-ASCII characters in other places (e.g. the ⚠️ warning emoji at auth.py:67, ─ separators throughout) that would crash the same way on a cp1252 console.
2. Guard _print_logo with a try/except + ASCII fallback. Less robust — only protects this one site, leaves the other Unicode call sites as latent crashes.
Stack trace
agents-cli v0.1.3
Traceback (most recent call last):
File "...\google\agents\cli\setup\cmd_setup.py", line 41, in _print_logo
click.secho(
" █▀█ █▀▀ █▀▀ █▄ █ ▀█▀ █▀ █▀▀ █ █",
fg="blue",
bold=True,
)
File "...\click\termui.py", line 698, in secho
return echo(message, file=file, nl=nl, err=err, color=color)
File "...\click\utils.py", line 324, in echo
file.write(out)
File "...\Lib\encodings\cp1252.py", line 19, in encode
return codecs.charmap_encode(input, self.errors, encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode characters in position 1-3: character maps to <undefined>
Client information
- CLI:
agents-cli v0.1.3
- OS: Windows 11 (10.0.26200)
- Python: 3.14 (uvx-managed)
- Console: PowerShell 5.1, default cp1252 codepage
- Install:
uvx google-agents-cli setup
What happened?
On a fresh Windows 11 install,
uvx google-agents-cli setupcrashes withUnicodeEncodeError: 'charmap' codec can't encode characters in position 1-3before reaching any setup logic. The crash happens inside_print_logo()atsetup/cmd_setup.py:41because the logo is drawn with Unicode block characters (█ ▀ ▄, U+2588 / U+2580 / U+2584), and Python on Windows defaults to writing stdout through the legacy cp1252 codepage, which has no glyphs for those characters.This is independent of #14. After working around #14 (or installing without gcloud needing to be called), this bug still prevents
setupfrom running unless the user happens to know to setPYTHONUTF8=1. For a "getting started" command, that's a hard wall on Windows.Steps to Reproduce
PYTHONUTF8set.uvx google-agents-cli setupWhat did you expect to happen?
setupshould print the logo (or a non-fancy fallback) and proceed.Workaround
or permanently:
[Environment]::SetEnvironmentVariable("PYTHONUTF8", "1", "User").Suggested fix
Two options, in order of preference:
1. Reconfigure stdio at CLI entry. Near the top of
main.py, before anyclick.sechoruns:This fixes the logo and any future Unicode-bearing output. The codebase already prints non-ASCII characters in other places (e.g. the
⚠️warning emoji atauth.py:67,─separators throughout) that would crash the same way on a cp1252 console.2. Guard
_print_logowith a try/except + ASCII fallback. Less robust — only protects this one site, leaves the other Unicode call sites as latent crashes.Stack trace
Client information
agents-cli v0.1.3uvx google-agents-cli setup