{"record":{"id":"6fac7bc8a9a751a0","repo":"github/spec-kit","slug":"catalog-source-source-id-is-missing-its-prior","errorCode":null,"errorMessage":"Catalog source '{source_id}' is missing its 'priority'.","messagePattern":"Catalog source '(.+?)' is missing its 'priority'\\.","errorType":"exception","errorClass":"BundlerError","httpStatus":null,"severity":"error","filePath":"src/specify_cli/bundler/models/catalog.py","lineNumber":80,"sourceCode":"    scope: Scope = Scope.PROJECT\n\n    @property\n    def install_allowed(self) -> bool:\n        return self.install_policy is InstallPolicy.INSTALL_ALLOWED\n\n    @classmethod\n    def from_dict(cls, data: Any, scope: Scope) -> \"CatalogSource\":\n        if not isinstance(data, dict):\n            raise BundlerError(\"Each catalog source must be a mapping.\")\n        source_id = str(data.get(\"id\", \"\")).strip()\n        url = str(data.get(\"url\", \"\")).strip()\n        if not source_id:\n            raise BundlerError(\"A catalog source is missing its 'id'.\")\n        if not url:\n            raise BundlerError(f\"Catalog source '{source_id}' is missing its 'url'.\")\n        priority = data.get(\"priority\")\n        if priority is None:\n            raise BundlerError(f\"Catalog source '{source_id}' is missing its 'priority'.\")\n        if isinstance(priority, bool) or not isinstance(priority, (int, str)):\n            raise BundlerError(\n                f\"Catalog source '{source_id}' has a non-integer priority: {priority!r}.\"\n            )\n        try:\n            priority_int = int(priority)\n        except (TypeError, ValueError):\n            raise BundlerError(\n                f\"Catalog source '{source_id}' has a non-integer priority: {priority!r}.\"\n            ) from None\n        return cls(\n            id=source_id,\n            url=url,\n            priority=priority_int,\n            install_policy=InstallPolicy.parse(data.get(\"install_policy\")),\n            scope=scope,\n        )\n","sourceCodeStart":62,"sourceCodeEnd":98,"githubUrl":"https://github.com/github/spec-kit/blob/bf88c9f9a82fa370c7a7257aa2b3cf10b457b65c/src/specify_cli/bundler/models/catalog.py#L62-L98","documentation":"Raised by CatalogSource.from_dict() when a source mapping omits 'priority' entirely (data.get('priority') is None). Priority is required because the effective source stack is priority-sorted across project, user, and built-in scopes; there is no implicit default when reading raw config.","triggerScenarios":"A config entry with id/url/policy but no priority key; priority explicitly set to null in JSON; hand-authored entries copied from a schema that made priority optional.","commonSituations":"Hand-writing config from memory; older configs written before priority existed; YAML with 'priority:' left empty (parses as None).","solutions":["Add an integer 'priority' to the source mapping (lower typically wins in the sorted stack — check your stack's sort direction convention).","If creating sources programmatically, use add_source(root, id, url, priority=N, policy=...) which requires priority explicitly and stores int(priority).","Ensure YAML entries are not 'priority:' with no value."],"exampleFix":"# before\n{\"id\": \"example\", \"url\": \"https://example.com/c.json\", \"install_policy\": \"install-allowed\"}\n\n# after\n{\"id\": \"example\", \"url\": \"https://example.com/c.json\", \"priority\": 10, \"install_policy\": \"install-allowed\"}","handlingStrategy":"validation","validationCode":"if entry.get(\"priority\") is None:\n    raise ValueError(\"source entry missing 'priority'\")\nCatalogSource.from_dict(entry, Scope.PROJECT)","typeGuard":"def has_priority(entry: dict) -> bool:\n    return isinstance(entry, dict) and entry.get(\"priority\") is not None","tryCatchPattern":"try:\n    CatalogSource.from_dict(entry, Scope.PROJECT)\nexcept BundlerError as e:\n    if \"missing its 'priority'\" in str(e):\n        entry[\"priority\"] = 100  # apply your default, then retry","preventionTips":["Always pass an explicit priority when calling add_source().","In YAML, never leave 'priority:' empty.","Document your project's priority ordering convention so chosen ints are consistent."],"tags":["bundler","catalog","validation","missing-field","priority"],"backgroundTag":null,"analyzedSha":"bf88c9f9a82fa370c7a7257aa2b3cf10b457b65c","analyzedAt":"2026-08-14T19:43:37.150Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}