snapcraft should not dump stacktrace on missing LANG
Metadata
Current evaluation
Snapcraft now defaults to C.UTF-8 when locale variables are unset, preventing the Click ASCII traceback. Fixed by snapcore/snapcraft#1893 in commit 0d5b88a41.
Resolution: closed resolved
Reason: Merged PR snapcore/snapcraft#1893 added a C.UTF-8 fallback when no locale is set. The change landed in commit 0d5b88a41.
Evaluated by: mr-cal-bot
No scores available.
Issue body
Hi,
If you don't have LC_ALL or LANG set, as is the case for Docker by default, snapcraft will bail with this not instructive error message:
snapcraft --help
Traceback (most recent call last):
File "/usr/bin/snapcraft", line 9, in <module>
load_entry_point('snapcraft==2.35', 'console_scripts', 'snapcraft')()
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 542, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2569, in load_entry_point
return ep.load()
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2229, in load
return self.resolve()
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2235, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/usr/lib/python3/dist-packages/snapcraft/cli/__main__.py", line 19, in <module>
run(prog_name='snapcraft')
File "/usr/lib/python3/dist-packages/click/core.py", line 716, in __call__
return self.main(*args, **kwargs)
File "/usr/lib/python3/dist-packages/click/core.py", line 675, in main
_verify_python3_env()
File "/usr/lib/python3/dist-packages/click/_unicodefun.py", line 119, in _verify_python3_env
'mitigation steps.' + extra)
RuntimeError: Click will abort further execution because Python 3 was configured to use ASCII as encoding for the environment. Either run this under Python 2 or consult http://click.pocoo.org/python3/ for mitigation steps.
This system supports the C.UTF-8 locale which is recommended.
You might be able to resolve your issue by exporting the
following environment variables:
export LC_ALL=C.UTF-8
export LANG=C.UTF-8
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed resolved | Snapcraft now defaults to C.UTF-8 when locale variables are unset, preventing the Click ASCII traceback. Fixed by snapcore/snapcraft#1893 in commit 0d5b88a41. | |
| stealth/space-bunny-alpha | — | closed resolved | Snapcraft gained a C.UTF-8 fallback when LANG/LC_ALL are unset, preventing Click locale stack traces. Merged in canonical/snapcraft#1893 via commit 0d5b88a41. | |
| stealth/space-bunny-alpha | — | closed resolved | Fixed by #1893 (commit 0d5b88a41): Snapcraft now uses C.UTF-8 when no locale is set, preventing Click's ASCII-encoding abort and stack trace. | |
| qwen/qwen3.6-35b-a3b | — | — | Closed without comments or resolution details. The locale crash was likely addressed in a subsequent release or abandoned. | |
| qwen/qwen3.6-35b-a3b | — | — | Closed and fixed by implementing a locale fallback to prevent stacktraces when LANG or LC_ALL is unset, ensuring graceful error handling in Docker environments. | |
| qwen/qwen3.6-35b-a3b | — | — | Closed without a fix or resolution. Zero comments indicate the issue was likely abandoned or resolved by the user without tracking. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Closed without comments. The locale crash was resolved by upstream Click updates and modern base images defaulting to C.UTF-8. |
Update history
| Date | Change |
|---|---|
| created |
Related work
-
Likely Fixed By:
snapcore/snapcraft#1893
(confidence 100%)
The PR implemented the locale fallback and resolved the reported missing-LANG failure.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #1628457 snapcraft fails on s390x with utf8 error | snapcraft (launchpad) | closed | Snapcraft's s390x UTF-8/surrogate failure was fixed by merged PR snapcore/snapcraft#838, adding encoding-aware file handling in pluginhandler (commit 01848ee71). |