You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Windows 10/11 with cp1252 stdout (default PowerShell)
Live audit result
11 PASS / 3 FAIL (docker env, browser x2)
Executive summary
The live bot gateway E2E harness (e2e-platform-audit/bot_gateway_e2e.py --live-only) validates praisonai-bot, MCP, code execution, sandbox, and browser control end-to-end. On Windows with default cp1252 console encoding, the browser control checks fail with a secondary UnicodeEncodeError on box-drawing character ║ (U+2551) instead of surfacing the actionable root cause: Playwright browser binaries are not installed (playwright install).
Developer sees 'charmap' codec can't encode character '\u2551' instead of playwright install
11 of 14 live checks pass (gateway, MCP, code, sandbox). Docker failure is environment-dependent (daemon not running). Browser failure is a double bug: missing Playwright browsers plus encoding-unsafe error reporting.
Environment
Field
Value
OS
Windows 10 (10.0.19045)
Shell
PowerShell (legacy conhost)
Python
3.13.2 (E2E runner); gateway subprocess may use 3.11
Console encoding
cp1252
OPENAI_API_KEY
Present (required for live tests)
PRAISONAI_AUTO_APPROVE
true
Playwright Python package
Installed
Playwright browser binaries
Not installed (playwright install not run)
Docker daemon
Not reachable (separate env failure)
Package versions (audit)
praisonai-bot 0.0.41, praisonai-browser 0.0.8
Step-by-step reproduction
# 1. Clone repo
git clone https://github.com/MervinPraison/PraisonAI.git
cd PraisonAI
# 2. Install packages (editable monorepo or pip install -e ".[all]")
pip install -e ".[all]"
pip install websockets pytest pytest-asyncio
# 3. Ensure Playwright browsers are NOT installed (default fresh env)# Skip: playwright install chromium# 4. Set API key and auto-approve$env:OPENAI_API_KEY="<your-key>"$env:PRAISONAI_AUTO_APPROVE="true"# 5. Do NOT force UTF-8 — reproduce cp1252Remove-Item Env:PYTHONUTF8 -ErrorAction SilentlyContinue
# 6. Run live-only E2E
python e2e-platform-audit/bot_gateway_e2e.py --live-only
Expected behavior
Browser checks FAIL with clear message: Please run: playwright install
Other live checks pass (gateway, MCP, code, sandbox)
E2E harness completes without crashing its own stdout
Actual behavior
Gateway, MCP, code, sandbox checks PASS
browser control (playwright headless)FAIL — detail truncated but contains playwright install and ║ chars (visible in JSON report)
browser control via bot messageFAIL — detail shows encoding error, not Playwright hint
The browser control (playwright headless) check captured the real error before the outer handler failed:
{
"name": "browser control (playwright headless)",
"status": "FAIL",
"detail": "updated. \u2551\r\n\u2551 Please run the following command to download new browsers: \u2551\r\n\u2551\u2551\r\n\u2551 playwright install ",
"duration_s": 10.3
},
{
"name": "browser control via bot message",
"status": "FAIL",
"detail": "'charmap' codec can't encode character '\\u2551' in position 62: character maps to <undefined>",
"duration_s": 10.3
}
The JSON file is UTF-8 and preserves the Playwright hint; the console loses it due to cp1252 print().
Interactive analysis
Symptom → diagnosis → fix flowchart
flowchart TD
A[bot_gateway_e2e.py --live-only] --> B[browser control check]
B --> C[_playwright_headless_probe subprocess]
C --> D{Browsers installed?}
D -->|No| E[Playwright stderr with U+2551 box chars]
D -->|Yes| F[Browser probe PASS]
E --> G[str exc captured in Report.detail]
G --> H[Report.add calls print detail]
H --> I{stdout encoding cp1252?}
I -->|Yes| J[UnicodeEncodeError on U+2551]
I -->|No UTF-8| K[Playwright hint visible in console]
J --> L[Outer except: charmap error shown]
L --> M[Developer misdiagnoses as encoding bug]
K --> N[Developer runs playwright install]
J --> O[Fix: safe_print + ASCII sanitize subprocess output]
O --> P[Console shows playwright install hint]
Loading
Failure sequence diagram
sequenceDiagram
participant E2E as bot_gateway_e2e.py
participant PW as Playwright subprocess
participant R as Report.add / print()
participant Out as stdout cp1252
E2E->>PW: chromium.launch headless probe
PW-->>E2E: stderr with ║ framed "playwright install"
E2E->>E2E: Check FAIL detail = str(exc)[:200]
E2E->>R: add(FAIL, detail with ║)
R->>Out: print(f"[FAIL] ... {detail}")
Out-->>R: UnicodeEncodeError U+2551
R-->>E2E: exception in outer browser block
E2E->>R: add(FAIL, "charmap codec...")
Note over E2E: Real fix (playwright install) hidden from console
When Chromium is not installed, Playwright emits a multi-line banner using box-drawing characters (║ U+2551). This is correctly captured in RuntimeError message.
Bare print() encodes check.detail to cp1252 stdout. When detail contains ║, Python raises UnicodeEncodeError.
Layer 3: Outer exception handler masks root cause
Browser block lines 571–640:
exceptExceptionasexc:
report.add(Check("browser control via bot message", "FAIL", str(exc)[:200], time.time() -t0))
If report.add() itself raises (or a prior add in the same block fails), the outer handler records the encoding error, not the Playwright install hint.
Note on PYTHONUTF8 in harness
The script sets os.environ.setdefault("PYTHONUTF8", "1") at line 30, but this does not reliably reconfigure an already-initialized stdout on all Windows Python builds. Audit was run with cp1252-active console; failure reproduced.
Impact assessment
Check
Result
Notes
Package imports
PASS
All five packages
Gateway startup
PASS
127.0.0.1:18765
MCP /mcp endpoint
PASS
Agent tool listed
MCP tools/call
PASS
Live LLM round-trip
praisonai-code via WS
PASS
E2E_CODE_OK marker
Sandbox via WS
PASS
E2E_SANDBOX_OK marker
Docker sandbox
FAIL
Env: daemon not running
Browser Playwright probe
FAIL
Browsers not installed
Browser via bot message
FAIL
Encoding masks Playwright hint
Severity justification: Medium
Blocks Windows developers from diagnosing browser setup
Does not affect Linux/macOS CI with UTF-8
Real fix for users is playwright install, but they cannot discover it from console output
Proposed fixes
Fix 1: Encoding-safe Report.add() (required)
Before (e2e-platform-audit/bot_gateway_e2e.py, lines 60–63):
[BUG][Windows] Bot gateway E2E browser check crashes on cp1252 when Playwright stderr contains box-drawing characters
Metadata
bug,windows,praisonai-bot,browser,developer-experience,e2ee2e-platform-audit/bot_gateway_e2e.py, Playwright subprocess captureExecutive summary
The live bot gateway E2E harness (
e2e-platform-audit/bot_gateway_e2e.py --live-only) validates praisonai-bot, MCP, code execution, sandbox, and browser control end-to-end. On Windows with default cp1252 console encoding, the browser control checks fail with a secondaryUnicodeEncodeErroron box-drawing character ║ (U+2551) instead of surfacing the actionable root cause: Playwright browser binaries are not installed (playwright install).The failure chain is:
_playwright_headless_probe()subprocess returns Playwright's framed install hint (uses║box-drawing borders)Report.detailviastr(exc)[:200]Report.add()calls bareprint()on the detail string (line 63)║→ outerUnicodeEncodeErrorreplaces the Playwright message'charmap' codec can't encode character '\u2551'instead ofplaywright install11 of 14 live checks pass (gateway, MCP, code, sandbox). Docker failure is environment-dependent (daemon not running). Browser failure is a double bug: missing Playwright browsers plus encoding-unsafe error reporting.
Environment
OPENAI_API_KEYPRAISONAI_AUTO_APPROVEtrueplaywright installnot run)Step-by-step reproduction
Expected behavior
Please run: playwright installActual behavior
browser control (playwright headless)FAIL — detail truncated but containsplaywright installand║chars (visible in JSON report)browser control via bot messageFAIL — detail shows encoding error, not Playwright hint=== Done: 3 failed ===(docker + browser x2)Full terminal evidence
Live E2E console output (sanitized paths)
JSON report excerpt (shows masked Playwright message)
The
browser control (playwright headless)check captured the real error before the outer handler failed:{ "name": "browser control (playwright headless)", "status": "FAIL", "detail": "updated. \u2551\r\n\u2551 Please run the following command to download new browsers: \u2551\r\n\u2551 \u2551\r\n\u2551 playwright install ", "duration_s": 10.3 }, { "name": "browser control via bot message", "status": "FAIL", "detail": "'charmap' codec can't encode character '\\u2551' in position 62: character maps to <undefined>", "duration_s": 10.3 }The JSON file is UTF-8 and preserves the Playwright hint; the console loses it due to cp1252
print().Interactive analysis
Symptom → diagnosis → fix flowchart
flowchart TD A[bot_gateway_e2e.py --live-only] --> B[browser control check] B --> C[_playwright_headless_probe subprocess] C --> D{Browsers installed?} D -->|No| E[Playwright stderr with U+2551 box chars] D -->|Yes| F[Browser probe PASS] E --> G[str exc captured in Report.detail] G --> H[Report.add calls print detail] H --> I{stdout encoding cp1252?} I -->|Yes| J[UnicodeEncodeError on U+2551] I -->|No UTF-8| K[Playwright hint visible in console] J --> L[Outer except: charmap error shown] L --> M[Developer misdiagnoses as encoding bug] K --> N[Developer runs playwright install] J --> O[Fix: safe_print + ASCII sanitize subprocess output] O --> P[Console shows playwright install hint]Failure sequence diagram
sequenceDiagram participant E2E as bot_gateway_e2e.py participant PW as Playwright subprocess participant R as Report.add / print() participant Out as stdout cp1252 E2E->>PW: chromium.launch headless probe PW-->>E2E: stderr with ║ framed "playwright install" E2E->>E2E: Check FAIL detail = str(exc)[:200] E2E->>R: add(FAIL, detail with ║) R->>Out: print(f"[FAIL] ... {detail}") Out-->>R: UnicodeEncodeError U+2551 R-->>E2E: exception in outer browser block E2E->>R: add(FAIL, "charmap codec...") Note over E2E: Real fix (playwright install) hidden from consoleRoot cause analysis
Layer 1: Missing Playwright browsers (environment)
_playwright_headless_probe()ate2e-platform-audit/bot_gateway_e2e.pylines 385–408 runs:When Chromium is not installed, Playwright emits a multi-line banner using box-drawing characters (
║U+2551). This is correctly captured inRuntimeErrormessage.Layer 2: Encoding-unsafe console reporting (bug)
Report.add()at lines 60–63:Bare
print()encodescheck.detailto cp1252 stdout. When detail contains║, Python raisesUnicodeEncodeError.Layer 3: Outer exception handler masks root cause
Browser block lines 571–640:
If
report.add()itself raises (or a prior add in the same block fails), the outer handler records the encoding error, not the Playwright install hint.Note on PYTHONUTF8 in harness
The script sets
os.environ.setdefault("PYTHONUTF8", "1")at line 30, but this does not reliably reconfigure an already-initialized stdout on all Windows Python builds. Audit was run with cp1252-active console; failure reproduced.Impact assessment
Severity justification: Medium
playwright install, but they cannot discover it from console outputProposed fixes
Fix 1: Encoding-safe
Report.add()(required)Before (
e2e-platform-audit/bot_gateway_e2e.py, lines 60–63):After:
Fix 2: Sanitize subprocess stderr before storing in Check.detail
In
_playwright_headless_probe()after decoding stderr:Fix 3: Pre-flight browser check with ASCII-only message
Add early check before live gateway tests:
Skip browser bot checks when pre-flight fails — avoids cascading encoding errors.
Fix 4: Wrap
report.addin try/except (defensive)Workarounds
Workaround 1: Install Playwright browsers (fixes root environment issue)
Workaround 2: Force UTF-8 console
Workaround 3: Read JSON report instead of console
The JSON report preserves the Playwright install message even when console fails.
Test plan
Manual (Windows cp1252, browsers not installed)
playwright installor ASCII equivalent — notcharmap codecManual (Windows cp1252, browsers installed)
browser control (playwright headless)PASSbrowser bot agent via WS messagePASS or fails with LLM-related reason onlyUnit test for safe console
CI recommendation
Acceptance criteria
bot_gateway_e2e.py --live-onlynever raisesUnicodeEncodeErrorfromReport.add()playwright installhint in ASCIIplaywright install chromiumas prerequisite for browser E2ERelated files
e2e-platform-audit/bot_gateway_e2e.pyReport.add,_playwright_headless_probesrc/praisonai-bot/praisonai_bot/cli/features/bots_cli.pyBrowserBaseTool, line ~980)src/praisonai-browser/e2e-platform-audit/logs/bot-gateway-e2e/report_*.jsonReferences
e2e-platform-audit/logs/full-audit/bot-gateway-live.txt(sanitized in this issue)