Principle:20000419 Fauxnix Error Normalization
| Knowledge Sources | |
|---|---|
| Domains | Error_Rewriting, Output_Normalization |
| Last Updated | 2026-10-26 00:00 GMT |
Overview
An error-rewriting technique that strips host-specific diagnostic noise and rewrites shell error messages from the host's locale (en-US and zh-CN) into the GNU/bash style agents expect, so pattern-matching on familiar Linux error text works across locales.
Description
When a command fails in PowerShell, the raw stderr contains host-specific noise: CategoryInfo, FullyQualifiedErrorId, CLIXML-serialized error records, and locale-specific phrasings. Agents and scripts that pattern-match on bash-style errors (command not found, No such file or directory, Permission denied) would break on these. Error Normalization strips the noise lines, unwraps CLIXML-serialized records, and rewrites the common error patterns — in both en-US and zh-CN — into their bash equivalents. It also adds Windows-specific hints (try `python` or `py` on Windows for missing python3; .sh scripts cannot run natively on Windows) that a Linux-trained agent would not otherwise know.
Usage
Use this principle whenever translated commands run in a host whose error format differs from the source shell's. The locale-aware rewriting ensures an agent that expects GNU error text keeps working regardless of the host's display language.
Theoretical Basis
normalizeStderr(stderr):
unwrapped = extractClixml(stderr) # unwrap #< CLIXML ... </S> records
lines = filter(unwrapped, not PS_NOISE) # drop CategoryInfo, FullyQualifiedErrorId, ...
for each line:
if matches "The term 'x' is not recognized" → "bash: x: command not found"
if matches zh-CN "无法将"x"项识别为..." → "bash: x: command not found"
if matches "Cannot find path 'D:\x'" → "cat: D:/x: No such file or directory"
if matches "Access to the path 'x' is denied" → "rm: cannot remove 'x': Permission denied"
collapse blank runs; trim leading/trailing