github/spec-kit · error · PresetValidationError

Missing preset.{field}

Error message

Missing preset.{field}

What it means

Error "Missing preset.{field}" thrown in github/spec-kit.

Source

Thrown at src/specify_cli/presets/__init__.py:340

                    f"Invalid {section}: expected a mapping"
                )

        # Validate preset metadata
        pack = self.data["preset"]
        # Check presence AND type: the format/version checks below feed these
        # values straight to ``re.match`` and ``packaging.Version``, both of
        # which raise a bare TypeError on a non-string. YAML makes that an easy
        # authoring slip -- unquoted ``version: 1.0`` parses as a float and
        # ``id: 2`` as an int -- and TypeError is not a PresetValidationError,
        # so it escapes every caller that already handles a malformed manifest
        # (see list_installed()'s "Corrupted preset" fallback, which catches
        # PresetValidationError only, making one bad preset exit ``specify
        # preset list`` with a raw traceback and hide the healthy ones).
        # Mirrors the sibling IntegrationDescriptor, which already type-checks
        # the same four fields.
        for field in ["id", "name", "version", "description"]:
            if field not in pack:
                raise PresetValidationError(f"Missing preset.{field}")
            if not isinstance(pack[field], str):
                raise PresetValidationError(
                    f"Invalid preset.{field}: expected a string, "
                    f"got {type(pack[field]).__name__}"
                )

        # Validate pack ID format
        if not re.match(r'^[a-z0-9-]+$', pack["id"]):
            raise PresetValidationError(
                f"Invalid preset ID '{pack['id']}': "
                "must be lowercase alphanumeric with hyphens only"
            )

        # Validate semantic version
        try:
            pkg_version.Version(pack["version"])
        except pkg_version.InvalidVersion:
            raise PresetValidationError(f"Invalid version: {pack['version']}")

View on GitHub (pinned to bf88c9f9a8)

Solutions

  1. Add the missing preset.<field> entry to the manifest.

When it happens

Trigger: Thrown at src/specify_cli/presets/__init__.py:340 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of github/spec-kit@bf88c9f9a8 (2026-08-14). Data as JSON: /api/errors/d06e1bbbc8df3817. Report an issue: GitHub.