github/spec-kit · error · PresetValidationError

Preset must provide at least one template

Error message

Preset must provide at least one template

What it means

Error "Preset must provide at least one template" thrown in github/spec-kit.

Source

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

        # later as ``AttributeError: 'str' object has no attribute 'filter'`` from
        # inside .contains(). Neither is a PresetCompatibilityError, so both
        # bypass the CLI's "Compatibility Error" handler and exit 1 with a raw
        # traceback naming no field. An unquoted ``speckit_version: 1.0`` is an
        # easy YAML slip. Mirrors the sibling IntegrationDescriptor, which already
        # requires a non-empty string here.
        if (
            not isinstance(requires["speckit_version"], str)
            or not requires["speckit_version"].strip()
        ):
            raise PresetValidationError(
                "Invalid requires.speckit_version: expected a non-empty string, "
                f"got {type(requires['speckit_version']).__name__}"
            )

        # Validate provides section
        provides = self.data["provides"]
        if "templates" not in provides:
            raise PresetValidationError(
                "Preset must provide at least one template"
            )

        # Validate templates. Guard the container and each entry's shape so a
        # malformed third-party preset.yml (e.g. ``templates: 5`` or
        # ``templates: [null]``) raises a clean PresetValidationError the
        # install handler already catches, instead of a raw TypeError
        # ('int'/'NoneType' object is not iterable) that escapes to an
        # unhandled traceback. Mirrors the sibling ExtensionManifest guards.
        #
        # Order matters: the container's TYPE is checked before its emptiness,
        # so a FALSY non-list (``templates: 0``/``false``/``null``/``''``/``{}``)
        # reports the accurate type error rather than the misleading "must
        # provide at least one template". An empty list still reports the
        # latter, since that genuinely is a list with no templates.
        templates = provides["templates"]
        if not isinstance(templates, list):
            raise PresetValidationError(

View on GitHub (pinned to bf88c9f9a8)

Solutions

  1. Add at least one template entry under provides.templates in the preset manifest.

When it happens

Trigger: Thrown at src/specify_cli/presets/__init__.py:387 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/0fa025696356886e. Report an issue: GitHub.