fix: force UTF-8 console so Oracle server starts on Windows cp1252#19
Merged
Conversation
run_oracle printed a '→' in its startup banner, which crashed with UnicodeEncodeError on Windows consoles/pipes using the cp1252 code page (observed on Python 3.14), so the server never finished booting. Added _force_utf8_console(), called first in run_oracle, to reconfigure stdout/stderr to UTF-8 (errors="replace") — covering both startup banners and the logging StreamHandler. Verified the server now boots without the PYTHONIOENCODING=utf-8 workaround. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR addresses a Windows-only Oracle server startup crash caused by writing a → character to stdout/stderr when the active console/pipes use the cp1252 code page (triggering UnicodeEncodeError).
Changes:
- Add
_force_utf8_console()to reconfiguresys.stdout/sys.stderrto UTF-8 witherrors="replace". - Call
_force_utf8_console()at the start ofrun_oracle()so startup banners and early log output won’t crash.
Comment on lines
+828
to
+835
| def _force_utf8_console() -> None: | ||
| """Make stdout/stderr UTF-8 so banner/log output can't crash on legacy | ||
| Windows code pages (cp1252 raises UnicodeEncodeError on chars like '→').""" | ||
| for stream in (sys.stdout, sys.stderr): | ||
| try: | ||
| stream.reconfigure(encoding="utf-8", errors="replace") | ||
| except (AttributeError, ValueError, OSError): | ||
| pass |
|
|
||
| def run_oracle(port: int = None, open_browser: bool = None): | ||
| """Main entry point for Oracle server.""" | ||
| _force_utf8_console() |
drknowhow
added a commit
that referenced
this pull request
Jun 14, 2026
… <1s (v2.38.1) (#20) build_runtime() did ~20s of synchronous ML init (chromadb VectorStore + EmbeddingIndex construction + Ollama probes) before the MCP handshake, exceeding Claude Code's default MCP startup timeout and marking c3 "× Failed to connect". Both stores now initialize their chromadb/Ollama backends lazily on first use via a lock-guarded, idempotent _ensure_ready(); work methods self-ensure, status views (ready/vector_enabled/get_stats) stay non-blocking. The MCP lifespan warms them in the background (and no longer gates the build on a synchronous .ready check, which would otherwise re-block the handshake). build_runtime drops from ~20s to ~0.26s; no MCP_TIMEOUT override needed. Bumps version to 2.38.1 and documents this plus the Windows cp1252 UTF-8 banner fix (#19) in the changelog. 427 tests pass. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes a Windows-only startup crash. The Oracle server's banner prints a
→character that raisesUnicodeEncodeErroron consoles/pipes using the cp1252 code page (observed on Python 3.14), sopython oracle/oracle_server.pynever finished booting — it required aPYTHONIOENCODING=utf-8workaround.Fix
_force_utf8_console()inoracle/oracle_server.py, called first inrun_oracle(), reconfiguresstdout/stderrto UTF-8 witherrors="replace". One place fixes the two startup banners and the loggingStreamHandler, and won't crash if a stream can't be reconfigured.Testing
Started the server without the
PYTHONIOENCODING=utf-8workaround that was previously required — it now boots cleanly andGET /api/healthreturns ok. Banner renders correctly:🤖 Generated with Claude Code