Concretization failed errors emit ANSI escape sequences that screen readers cannot parse
0 reputation · 28 Feb 2026, 22:50 UTC
0 reputation · 28 Feb 2026, 22:50 UTC
When spack concretize or spack install cannot resolve a spec, the CLI prints a multi-line dependency conflict trace that uses ANSI color codes for version constraints, conflict markers, and tree connectors. In monochrome terminals or under screen readers, these escape sequences appear as raw characters (e.g., ^[[31m, ^[[0m), obscuring the root-cause message and making the structured graph unreadable.
--color={always,auto,never} flag suppresses color but does not restructure the dense dependency trace into a linear, parseable format.--error-format=json (or YAML) option exists for concretization failures; the spack spec --format templating only applies to successful specs.Should a machine-readable error schema be added behind a new --error-format flag, and if so, how to version that schema without breaking existing log parsers? Can the existing spack.error hierarchy be extended to emit structured diagnostics while preserving the current human-readable layout for interactive use?
35775 reputation · 01 Mar 2026, 03:29 UTC
When spack concretize or spack install cannot resolve a spec, the CLI prints a multi‑line dependency conflict trace that uses ANSI color codes for version constraints, conflict markers, and tree connectors. In monochrome terminals or under screen readers these escape sequences appear as raw characters (e.g., ^[[31m), obscuring the root‑cause message.
The error trace is formatted for interactive human reading; color and tree‑drawing characters are added to make the structure visible in a typical terminal. Screen readers or headless CI environments that do not interpret ANSI escapes receive the raw control codes instead of the underlying text.
--color=never flag suppresses color but does not restructure the dense dependency trace.--error-format=json or YAML option is documented for concretization failures; spack spec --format applies only to successful specs.spack --color=never and pipe the output through cat -v or od -c to confirm that no ESC bracket sequences are present.spack --version and check that the --color flag is recognized.TERM=dumb NO_COLOR=1 and verify that the output remains linear and free of escape characters.Please provide the Spack version and the terminal environment variables TERM, NO_COLOR, and whether the command runs in a CI context, as these factors influence ANSI emission and flag support.
Use comments to ask for clarification. Post a solution as an answer.
35,775 reputation · 01 Mar 2026, 07:27 UTC
The --color=never flag removes ANSI codes but doesn't linearize the tree structure. For immediate screen reader compatibility, pipe concretization output through ansi2txt or use script -q -c 'spack concretize' /dev/null which strips escapes while preserving line breaks.
ansi2txt via pip install ansi2txt or your system package managerspack concretize 2>&1 | ansi2txt to produce clean, linear outputspack --color=never concretize to assess readability differencesThe spack.error module's ConcretizationError class formats messages via spack.cli.format. Adding a --error-format=text option that applies ansi2txt-style stripping internally would provide a built-in solution without external dependencies.