Trying to publish a release in CI fails with UnicodeDecodeError
Metadata
Current evaluation
Closed as a CI credential-entry error: a copied shell prefix corrupted SNAPCRAFT_STORE_CREDENTIALS. Refreshing the token fixed publishing; #5536 later improved the error.
Resolution: closed not a bug
Reason: The reporter confirmed that a shell prefix had been copied into the credentials and that replacing the token resolved the failure. PR #5536, merged as commit 3784560f3, added clearer handling for credential decoding errors.
Evaluated by: mr-cal-bot
No scores available.
Issue body
### Bug Description
Trying to upload a new snap version using the snapcraft CLI in our CI (Github ubunutu-latest) fails with `UnicodeDecodeError`, but trying to upload the same snap locally on my own ubuntu machine was successful.
### To Reproduce
1. Run `snapcraft upload --verbose --release=edge /home/runner/work/my-app.snap`
2. See error
### Environment
Ubuntu 22.04 LTS
### snapcraft.yaml
N/A
### Relevant log output
```log
Starting snapcraft, version 8.4.4
Logging execution to '/home/runner/.local/state/snapcraft/log/snapcraft-20241129-170703.651006.log'
snapcraft internal error: UnicodeDecodeError('utf-8', b'zf\xa2\x96\xc9\x9a\x96\xda\'\x9a*\xda\x9e\xd8\xacr\x89\xae\xb1\xea\xe7jg\xac\x99\xa9m\xa2x\x9d\xe3%\xaa\xf79\xb1ns\xcb<`l\x06\x10\x14M\x03!\'\xb4\x1e\xee\xe5\xb6\xa5\xea\xe6\x8a\xcb"\xa2{)i\xc9\x1a\x81\xe6\x9cq\xeb,\xa5\xa7$j\x07\xa6jv\xa0z\x96\x9c\x91\xa8\x1e\x99\xebk\x89\xcb)i\xc9\x1a\x81\xean\xb2\x1aZrF\xa0z\xb7\xa0\x8a\xcb^\xae\x96\x9c\x91\xa8\x1e\xad\xe9^j\xc7\xa9i\xc9\x1a\x81\xeb\xa9u\xab^r\x16\xa7\x9d\xe9l\x9e\x8a\xde\xb2\xda\xe2r\xd8\xa8\x9e\xc7\xb1\xa6*\xde\xb3m6\xe7]t\xf1=z\xd3\xcd\xf7\xd3M\x19', 2, 3, 'invalid start byte')
```
Full output log
```log
2024-11-29 19:13:45.262 Starting snapcraft, version 8.4.4
2024-11-29 19:13:45.262 Log verbosity level set to BRIEF
2024-11-29 19:13:45.262 Preparing application...
2024-11-29 19:13:45.262 snapcraft 8.4.4
2024-11-29 19:14:46.273 Starting snapcraft, version 8.4.4
2024-11-29 19:14:46.273 Log verbosity level set to BRIEF
2024-11-29 19:14:46.273 Preparing application...
2024-11-29 19:14:46.274 Configuring application...
2024-11-29 19:14:46.275 Setting up ConfigService
2024-11-29 19:14:46.284 Build plan: platform=None, build_for=None
2024-11-29 19:14:46.284 Running snapcraft upload on host
2024-11-29 19:14:46.285 snapcraft internal error: UnicodeDecodeError('utf-8', b'zf\xa2\x96\xc9\x9a\x96\xda\'\x9a*\xda\x9e\xd8\xacr\x89\xae\xb1\xea\xe7jg\xac\x99\xa9m\xa2x\x9d\xe3%\xaa\xf79\xb1ns\xcb<`l\x06\x10\x14M\x03!\'\xb4\x1e\xee\xe5\xb6\xa5\xea\xe6\x8a\xcb"\xa2{)i\xc9\x1a\x81\xe6\x9cq\xeb,\xa5\xa7$j\x07\xa6jv\xa0z\x96\x9c\x91\xa8\x1e\x99\xebk\x89\xcb)i\xc9\x1a\x81\xean\xb2\x1aZrF\xa0z\xb7\xa0\x8a\xcb^\xae\x96\x9c\x91\xa8\x1e\xad\xe9^j\xc7\xa9i\xc9\x1a\x81\xeb\xa9u\xab^r\x16\xa7\x9d\xe9l\x9e\x8a\xde\xb2\xda\xe2r\xd8\xa8\x9e\xc7\xb1\xa6*\xde\xb3m6\xe7]t\xf1=z\xd3\xcd\xf7\xd3M\x19', 2, 3, 'invalid start byte')
2024-11-29 19:14:46.290 Traceback (most recent call last):
2024-11-29 19:14:46.290 File "/snap/snapcraft/12961/lib/python3.10/site-packages/snapcraft/store/_legacy_account.py", line 41, in _load_potentially_base64_config
2024-11-29 19:14:46.290 parser.read_string(config_content)
2024-11-29 19:14:46.290 File "/snap/snapcraft/12961/usr/lib/python3.10/configparser.py", line 725, in read_string
2024-11-29 19:14:46.290 self.read_file(sfile, source)
2024-11-29 19:14:46.290 File "/snap/snapcraft/12961/usr/lib/python3.10/configparser.py", line 720, in read_file
2024-11-29 19:14:46.290 self._read(f, source)
2024-11-29 19:14:46.290 File "/snap/snapcraft/12961/usr/lib/python3.10/configparser.py", line 1087, in _read
2024-11-29 19:14:46.290 raise MissingSectionHeaderError(fpname, lineno, line)
2024-11-29 19:14:46.290 configparser.MissingSectionHeaderError: File contains no section headers.
2024-11-29 19:14:46.290 file: '<string>', line: 1
2024-11-29 19:14:46.290 '***\n'
2024-11-29 19:14:46.290
2024-11-29 19:14:46.290 During handling of the above exception, another exception occurred:
2024-11-29 19:14:46.290 Traceback (most recent call last):
2024-11-29 19:14:46.290 File "/snap/snapcraft/12961/lib/python3.10/site-packages/craft_application/application.py", line 568, in run
2024-11-29 19:14:46.290 return_code = self._run_inner()
2024-11-29 19:14:46.290 File "/snap/snapcraft/12961/lib/python3.10/site-packages/snapcraft/application.py", line 215, in _run_inner
2024-11-29 19:14:46.290 return_code = super()._run_inner()
2024-11-29 19:14:46.290 File "/snap/snapcraft/12961/lib/python3.10/site-packages/craft_application/application.py", line 549, in _run_inner
2024-11-29 19:14:46.290 return_code = dispatcher.run() or os.EX_OK
2024-11-29 19:14:46.290 File "/snap/snapcraft/12961/lib/python3.10/site-packages/craft_cli/dispatcher.py", line 487, in run
2024-11-29 19:14:46.290 return self._loaded_command.run(self._parsed_command_args)
2024-11-29 19:14:46.290 File "/snap/snapcraft/12961/lib/python3.10/site-packages/snapcraft/commands/upload.py", line 114, in run
2024-11-29 19:14:46.290 client = store.StoreClientCLI()
2024-11-29 19:14:46.290 File "/snap/snapcraft/12961/lib/python3.10/site-packages/snapcraft/store/client.py", line 179, in __init__
2024-11-29 19:14:46.290 self.store_client = get_client(ephemeral=ephemeral)
2024-11-29 19:14:46.290 File "/snap/snapcraft/12961/lib/python3.10/site-packages/snapcraft/store/client.py", line 126, in get_client
2024-11-29 19:14:46.290 or LegacyUbuntuOne.env_has_legacy_credentials()
2024-11-29 19:14:46.290 File "/snap/snapcraft/12961/lib/python3.10/site-packages/snapcraft/store/_legacy_account.py", line 128, in env_has_legacy_credentials
2024-11-29 19:14:46.290 get_auth(credentials)
2024-11-29 19:14:46.290 File "/snap/snapcraft/12961/lib/python3.10/site-packages/snapcraft/store/_legacy_account.py", line 86, in get_auth
2024-11-29 19:14:46.290 conf = _load_potentially_base64_config(config_content)
2024-11-29 19:14:46.290 File "/snap/snapcraft/12961/lib/python3.10/site-packages/snapcraft/store/_legacy_account.py", line 45, in _load_potentially_base64_config
2024-11-29 19:14:46.290 decoded_config_content = base64.b64decode(config_content).decode()
2024-11-29 19:14:46.290 UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa2 in position 2: invalid start byte
```
### Additional context
The snap was built using `electron-builder`
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed not a bug | Closed as a CI credential-entry error: a copied shell prefix corrupted SNAPCRAFT_STORE_CREDENTIALS. Refreshing the token fixed publishing; #5536 later improved the error. | |
| stealth/space-bunny-alpha | — | closed not a bug | Closed as a CI credential-entry error: an accidentally copied shell prefix corrupted the stored token; refreshing SNAPCRAFT_STORE_CREDENTIALS fixed it. craft-store#287 and snapcraft#5536 added clearer errors. | |
| qwen/qwen3.6-35b-a3b | — | — | Closed as user error. The UnicodeDecodeError during snapcraft upload was caused by accidentally copying shell prefix characters into the SNAPCRAFT_STORE_CREDENTIALS token. Refreshing credentials resolved the issue. Improved error handling is tracked in related PRs. | |
| qwen/qwen3.6-35b-a3b | — | — | Closed by author. The CI upload UnicodeDecodeError stemmed from a malformed SNAPCRAFT_STORE_CREDENTIALS env var with accidental copy-paste artifacts. Correcting the token resolved the failure. Improved error handling is tracked in separate PRs. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Resolved by author. The CI UnicodeDecodeError stemmed from accidentally copying shell prefix characters into the SNAPCRAFT_STORE_CREDENTIALS token. Refreshing the environment variable fixed the issue. Maintainers noted upcoming error message improvements via linked PRs. |
Update history
No update history recorded yet.
Related work
-
Likely Fixed By:
canonical/snapcraft#5536
(confidence 98%)
Merged commit 3784560f3 replaces the internal decoding traceback with a user-friendly credential parse error.
-
Related To:
canonical/craft-store#287
(confidence 96%)
The maintainer cited this PR alongside #5536 as providing clearer credential error messages.
Related issues
No related issues found above the similarity threshold.