[Bug]: 35 skill scripts print glyphs a cp1252 console cannot encode, so they crash on Windows before reporting anything

Author: aniruddhaadak80Created Sep 29, 2026Updated Sep 29, 2026

Area: Repository tooling (tests, CI workflows)

What happened

Several skill scripts report status with U+2713 CHECK MARK, U+2717 BALLOT X or U+2192 RIGHTWARDS ARROW. None of those are in cp1252, which is the default encoding of a stock Windows console, so the first such print raises UnicodeEncodeError and the process dies:

$ PYTHONIOENCODING=cp1252 python skills/deeptools/scripts/validate_files.py --bam no-such-file.bam
  File ".../validate_files.py", line 190, in main
    print("✗ Some validations failed. Please fix the issues above.")
UnicodeEncodeError: 'charmap' codec can't encode character '✗' in position 0

The important part is that this happens on the success path too — validate_files.py ends with print("✓ All validations passed!"), so a valid run is exactly as broken as a failing one. The tool reports nothing either way.

Scope, measured

I walked skills/**/*.py and tested each code point against the cp1252 codec rather than eyeballing it, which matters because it changes the answer:

Code point cp1252 Occurrences
U+2713 CHECK MARK cannot encode 134
U+2717 BALLOT X cannot encode 100
U+2192 RIGHTWARDS ARROW cannot encode 46
U+2014 EM DASH encodable 164
U+2013 EN DASH encodable 12

So the honest figure is 35 files and 280 offending occurrences, not the ~90 files you get from grepping for "non-ASCII" — em and en dashes are in cp1252 and are not part of this. 17 files print both a check mark and a ballot X, i.e. the report-a-status-line pattern.

Worst offenders:

bioservices/scripts/protein_analysis_workflow.py     28
bioservices/scripts/compound_cross_reference.py      17
infographics/scripts/generate_infographic_ai.py      17
bioservices/scripts/batch_id_converter.py            16
pymc/scripts/model_diagnostics.py                   16
diffdock/scripts/setup_check.py                      15
latex-posters/scripts/generate_schematic_ai.py       15
literature-review/scripts/generate_schematic_ai.py   15
scientific-schematics/scripts/generate_schematic_ai.py  15
scientific-slides/scripts/generate_schematic_ai.py  15
deeptools/scripts/validate_files.py                 14

Why this is worth a repository-level decision rather than a file-by-file patch

  1. generate_schematic_ai.py ships as byte-identical copies across four skills (latex-posters, literature-review, scientific-schematics, scientific-slides). AGENTS.md states those must change together because tests/_meta fails if they drift, so they cannot be fixed as four independent one-line patches.
  2. Adding a structural-contract rule for this would turn the guard red immediately, since 35 files currently violate it. The rule and the remediation have to land together, or the guard has to be staged.
  3. A per-script errors="replace" guard is invisible duplication across 35 files. A shared helper in tests/_contract/ is not importable from skills/, so the options are genuinely a design choice.
  4. The same class of problem exists in the validation tooling itself — [email protected] cannot run on a Windows host at all, which I hit while validating other contributions. Contributors on Windows are the group that keeps discovering this, and they are also the group least able to work around it.

Options, with tradeoffs

A. Tolerate the encoding, per script. Add a guarded stream.reconfigure(errors="replace") after the imports. Minimal per file, preserves the glyphs on UTF-8 terminals, degrades to ? on legacy code pages. 35 insertions of near-duplicate code.

B. ASCII-only status output. Replace the glyphs with [ok] / [FAIL]. Unambiguous everywhere including piped logs, but loses the nicer output on Linux and macOS.

C. Add a structural-contract rule and fix all 35 files in one PR. The durable fix: the class of bug cannot come back. Large diff, and it collides with the generate_schematic_ai.py copy constraint and with any other open PR touching those skills.

D. Declare the supported consoles in compatibility. If the answer is "these scripts assume a UTF-8 terminal", say so per skill so a Windows user gets a clear message instead of a traceback. Cheapest, and honest, but leaves the crash in place for anyone who does not read it.

My own read: A for the scripts that print status lines now (it is small, safe, and independently reviewable per skill), and C as a separate follow-up so the duplication and the contract rule are settled once rather than 35 times. I am not volunteering to land C unprompted, because a 35-file contract change is a maintainer-level decision and there are open PRs in several of the affected skills.

I have already fixed the deeptools instance (2 files, 18 offending occurrences) in a separate PR with tests that reproduce the crash under a forced PYTHONIOENCODING=cp1252, and reported the original instance on #286.

Steps to reproduce

$ python -c "print(chr(0x2713))"                      # Windows console, no PYTHONIOENCODING
UnicodeEncodeError: 'charmap' codec can't encode character '✓' in position 0

$ PYTHONIOENCODING=cp1252 python skills/deeptools/scripts/validate_files.py --bam no-such.bam
  ... UnicodeEncodeError: 'charmap' codec can't encode character '✗' in position 0

Error output

UnicodeEncodeError: 'charmap' codec can't encode character '✗' in position 0: character maps to <undefined>

Environment

  • Agent host: n/a (ran the scripts directly)
  • Model: n/a
  • Repository version or commit: 065b734 (main)
  • Python version: 3.12 / 3.13
  • Operating system: Windows 10, default console code page cp1252

Source: K-Dense-AI/scientific-agent-skills