Core24 accepts integer version, Core22 does not and gives obscure error
Metadata
Current evaluation
Integer version in snapcraft.yaml causes pydantic validation error with core22 base. Fixed in craft-parts via coerce_numbers_to_str.
Suggested action: close stale
Reason: The issue is already fixed in craft-parts: ProjectVar now uses `coerce_numbers_to_str=True` in its pydantic Field (with comment 'to handle unquoted versions'), which allows integer YAML values to be coerced to strings. This was added during the pydantic 2 migration (#771/#778).
Impact:
30
Quick Win:
24.0
Staleness:
85
Complexity:
20
Confidence:
80
Support Request:
10
Issue body
I had this snapcraft.yaml, which built fine:
--->
name: llvm-chromium
version: 20
base: core24
...
<---
Changing base to core22 causes the very same build to fail right away, which is already confusing enough, but then the error is also cryptic:
--->
Traceback (most recent call last):
File "/snap/snapcraft/12614/bin/snapcraft", line 8, in <module>
sys.exit(main())
File "/snap/snapcraft/12614/lib/python3.10/site-packages/snapcraft/application.py", line 498, in main
return cli.run()
File "/snap/snapcraft/12614/lib/python3.10/site-packages/snapcraft/cli.py", line 252, in run
_run_dispatcher(dispatcher, global_args)
File "/snap/snapcraft/12614/lib/python3.10/site-packages/snapcraft/cli.py", line 225, in _run_dispatcher
dispatcher.run()
File "/snap/snapcraft/12614/lib/python3.10/site-packages/craft_cli/dispatcher.py", line 487, in run
return self._loaded_command.run(self._parsed_command_args)
File "/snap/snapcraft/12614/lib/python3.10/site-packages/snapcraft/commands/core22/lifecycle.py", line 139, in run
parts_lifecycle.run(self.name, parsed_args)
File "/snap/snapcraft/12614/lib/python3.10/site-packages/snapcraft/parts/lifecycle.py", line 96, in run
_expand_environment(
File "/snap/snapcraft/12614/lib/python3.10/site-packages/snapcraft/parts/lifecycle.py", line 748, in _expand_environment
info = craft_parts.ProjectInfo(
File "/snap/snapcraft/12614/lib/python3.10/site-packages/craft_parts/infos.py", line 148, in __init__
self._project_vars = {k: ProjectVar(value=v) for k, v in pvars.items()}
File "/snap/snapcraft/12614/lib/python3.10/site-packages/craft_parts/infos.py", line 148, in <dictcomp>
self._project_vars = {k: ProjectVar(value=v) for k, v in pvars.items()}
File "/snap/snapcraft/12614/lib/python3.10/site-packages/pydantic/main.py", line 193, in __init__
self.__pydantic_validator__.validate_python(data, self_instance=self)
pydantic_core._pydantic_core.ValidationError: 1 validation error for ProjectVar
value
Input should be a valid string [type=string_type, input_value=20, input_type=int]
For further information visit https://errors.pydantic.dev/2.8/v/string_type
<---
After much scratching my head I noticed the "20" and then solved the problem by also editing
version: "20"
with quotes. Core24 was accepting version: 20 without quotes though.
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen3.6-35b-a3b-mtp-q6 |
Impact:
30
Quick Win:
24.0
Staleness:
85
Complexity:
20
Confidence:
80
Support Request:
10
|
close stale | Integer version in snapcraft.yaml causes pydantic validation error with core22 base. Fixed in craft-parts via coerce_numbers_to_str. | |
| qwen/qwen3.6-35b-a3b |
Staleness:
90
Complexity:
40
Confidence:
85
Support Request:
5
|
needs triage | Inconsistency where snapcraft core24 accepts integer version in snapcraft.yaml but core22 fails with a cryptic Pydantic validation error. Unlabelled and untouched for over 1.5 years. | |
| qwen/qwen3.6-35b-a3b |
Staleness:
65
Complexity:
40
Confidence:
85
Support Request:
10
|
needs triage | Inconsistency between Core24 and Core22 base handling of unquoted integer versions in snapcraft.yaml, causing a cryptic validation error for Core22. | |
| qwen3.6-35b-a3b-mtp-q6 |
Staleness:
92
Complexity:
25
Confidence:
85
Support Request:
10
|
needs triage | Inconsistent version field handling between core22 and core24 bases. core22 rejects integer versions with a cryptic Pydantic error, while core24 accepts them. Issue is untriaged and inactive for over a year. | |
| qwen3.6-35b-a3b-mtp-q6 |
Staleness:
92
Complexity:
45
Confidence:
85
Support Request:
10
|
needs triage | Inconsistency where core24 accepts integer version values but core22 fails with a cryptic Pydantic validation error. Unlabeled, no maintainer response, inactive for over a year. |
Update history
No update history recorded yet.
Related work
-
Likely Fixed By:
canonical/craft-parts#771
(confidence 85%)
Pydantic 2 migration added coerce_numbers_to_str=True to ProjectVar.value field, resolving the integer-to-string validation error.
Related issues
No related issues found above the similarity threshold.