github/spec-kit · error · PresetValidationError
Invalid priority for catalog '{item.get('name', idx + 1)}':
Error message
Invalid priority for catalog '{item.get('name', idx + 1)}': expected integer, got {raw_priority!r} What it means
A catalog entry's 'priority' value is a YAML boolean. Because bool is a subclass of int in Python, 'priority: true' would silently become 1; the loader explicitly rejects booleans with PresetValidationError to keep the three catalog validators consistent.
Source
Thrown at src/specify_cli/presets/__init__.py:4311
entries: List[PresetCatalogEntry] = []
for idx, item in enumerate(catalogs_data):
if not isinstance(item, dict):
raise PresetValidationError(
f"Invalid catalog entry at index {idx}: expected a mapping, got {type(item).__name__}"
)
url = str(item.get("url", "")).strip()
if not url:
continue
self._validate_catalog_url(url)
raw_priority = item.get("priority", idx + 1)
# Reject bools explicitly: ``bool`` is a subclass of ``int`` so
# ``int(True)`` silently returns 1, which would let a YAML
# ``priority: true`` slip through as a valid priority of 1. The
# sibling integration-catalog reader in ``catalogs.py`` already
# guards this; mirror the check here so the three catalog
# validators stay consistent.
if isinstance(raw_priority, bool):
raise PresetValidationError(
f"Invalid priority for catalog '{item.get('name', idx + 1)}': "
f"expected integer, got {raw_priority!r}"
)
try:
priority = int(raw_priority)
except (TypeError, ValueError, OverflowError):
# OverflowError: int(float("inf")) — a YAML ``priority: .inf``
# would otherwise escape as an uncaught traceback instead of the
# clean validation error (mirrors catalogs.py).
raise PresetValidationError(
f"Invalid priority for catalog '{item.get('name', idx + 1)}': "
f"expected integer, got {raw_priority!r}"
)
raw_install = item.get("install_allowed", False)
if isinstance(raw_install, str):
install_allowed = raw_install.strip().lower() in ("true", "yes", "1")
else:
install_allowed = bool(raw_install)View on GitHub (pinned to bf88c9f9a8)
Solutions
- Replace the boolean with an explicit integer priority (lower number = higher priority)
- Quote the value if it was meant as text, or remove the priority key entirely (it defaults to index+1)
- Avoid YAML 1.1 boolean words (yes/no/on/off) in integer fields
Example fix
# before
catalogs:
- url: https://example.com/catalog.json
priority: true
# after
catalogs:
- url: https://example.com/catalog.json
priority: 1 Defensive patterns
Strategy: validation
Validate before calling
for item in data["catalogs"]:
p = item.get("priority", 0)
if isinstance(p, bool):
raise ValueError(f"priority must be int, got bool {p}") Type guard
def is_int_priority(value: object) -> bool:
return isinstance(value, int) and not isinstance(value, bool) Try / catch
except PresetValidationError as e:
if "Invalid priority" in str(e) and "True/False" in str(e):
normalize_priorities_in_config(path) # map true->1, false->last
raise Prevention
- Use only plain integers for priority
- Avoid YAML 1.1 boolean words (yes/no/on/off) anywhere near numeric fields
- Add a preflight check rejecting bool priorities
When it happens
Trigger: Writing 'priority: true', 'priority: false', or any YAML value parsed as a boolean for a catalog entry in the preset catalog config.
Common situations: User intends priority 'yes'/'on' ( YAML 1.1 treats these as booleans) meaning 'enabled'; copy-paste from a config using a boolean flag schema; YAML 1.1 parsers interpreting 'on'/'off'/'yes'/'no' as bools.
Related errors
- Malformed catalog config at {path}: expected a mapping at th
- Malformed catalog config at {config_path}: expected a mappin
- Malformed catalog config at {config_path}: 'catalogs' must b
- Invalid extension.{field}: expected a string, got {type(ext[
- Failed to read catalog config {config_path}: {e}
AI-assisted analysis of github/spec-kit@bf88c9f9a8 (2026-08-14).
Data as JSON: /api/errors/82636409de45ede1.
Report an issue: GitHub.