Generic error message when registering snap names longer than allowed
Metadata
Current evaluation
Resolved service-side: SCA now returns code "invalid" for overlong snap names; PR #1247 updated registration error handling and Store integration tests.
Resolution: closed resolved
Reason: A maintainer confirmed SCA was fixed to populate the error code. canonical/snapcraft#1247 was merged as 03105a6c4 and updated registration handling and integration tests.
Evaluated by: mr-cal-bot
No scores available.
Issue body
The current response from the (staging) Store API does not comply with the existing error pattern (particularly, top-level "code" attribute is empty):
{{{
$ snapcraft staging servers> PYTHONPATH=. ./snapcraft/main.py register name-tooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo-long -d
Starting snapcraft 2.28 from ./snapcraft.
Registering name-tooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo-long.
Starting new HTTPS connection (1): myapps.developer.staging.ubuntu.com
"POST /dev/api/register-name/ HTTP/1.1" 400 None
==============================
{'detail': 'Submitted data is not valid.', 'title': 'Invalid request.', 'invalid_params': [{'code': '', 'reason': 'The name name-tooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo-long should not be longer than 40 characters.', 'name': 'snap_name'}], 'status': 400, 'error_list': [{'code': '', 'extra': {'name': 'snap_name'}, 'message': 'The name name-tooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo-long should not be longer than 40 characters.'}], 'type': 'devportal:v1:request-invalid'}
==============================
Traceback (most recent call last):
File "./snapcraft/main.py", line 381, in <module>
main() # pragma: no cover
File "./snapcraft/main.py", line 253, in main
return run(args, project_options)
File "./snapcraft/main.py", line 297, in run
_run_store_command(args)
File "./snapcraft/main.py", line 347, in _run_store_command
snapcraft.register(args['<snap-name>'], args['--private'])
File "/home/cprov/Canonical/snappy/snapcraft/snapcraft/_store.py", line 327, in register
store.register(snap_name, is_private)
File "/home/cprov/Canonical/snappy/snapcraft/snapcraft/storeapi/__init__.py", line 200, in register
self.sca.register, snap_name, is_private, constants.DEFAULT_SERIES)
File "/home/cprov/Canonical/snappy/snapcraft/snapcraft/storeapi/__init__.py", line 183, in _refresh_if_necessary
return func(*args, **kwargs)
File "/home/cprov/Canonical/snappy/snapcraft/snapcraft/storeapi/__init__.py", line 535, in register
raise errors.StoreRegistrationError(snap_name, response)
snapcraft.storeapi.errors.StoreRegistrationError: Registration failed.
}}}
Obs: error response printed with locally patched snapcraft.
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed resolved | Resolved service-side: SCA now returns code "invalid" for overlong snap names; PR #1247 updated registration error handling and Store integration tests. | |
| stealth/space-bunny-alpha | — | closed not a bug | Resolved on the service side: SCA began returning code "invalid" for overlong snap names. PR #1247 updated Snapcraft’s Store integration tests and registration error handling. | |
| stealth/space-bunny-alpha | — | closed stale | Store API returned HTTP 400 with empty error codes for overlong snap names, yielding only "Registration failed." No fix, linked PR, or closing explanation was identified. | |
| qwen/qwen3.6-35b-a3b | — | — | Closed without resolution. Reported generic API errors for snap names exceeding 40 characters due to an empty error code attribute. Likely abandoned or superseded by updated store API validation and client error handling. | |
| qwen/qwen3.6-35b-a3b | — | — | Closed. Fixed. Error handling was updated to properly parse the API response and display the specific snap name length violation instead of a generic error. |
Update history
| Date | Change |
|---|---|
| created |
Related work
-
Likely Fixed By:
canonical/snapcraft#1247
(confidence 98%)
Merged as 03105a6c4; covers registration handling and tests for the 40-character name limit.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #1644673 Trying to register a snap name with reserved characters fails opaquely | snapcraft (launchpad) | closed | Invalid snap names now produce a detailed allowed-character error. The handling landed in PR #1247 (03105a6c4), and Snapcraft v2.34 was confirmed to display it. |