github/spec-kit · error · PresetValidationError

Invalid provides.templates: expected a list

Error message

Invalid provides.templates: expected a list

What it means

Error "Invalid provides.templates: expected a list" thrown in github/spec-kit.

Source

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

            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(
                "Invalid provides.templates: expected a list"
            )
        if not templates:
            raise PresetValidationError(
                "Preset must provide at least one template"
            )
        for tmpl in templates:
            if not isinstance(tmpl, dict):
                raise PresetValidationError(
                    "Each template entry in 'provides.templates' must be a mapping"
                )
            if "type" not in tmpl or "name" not in tmpl or "file" not in tmpl:
                raise PresetValidationError(
                    "Template missing 'type', 'name', or 'file'"
                )

            # 'name' feeds re.match and 'file' feeds os.path.normpath below;
            # both raise a bare TypeError on a non-string, which is not a

View on GitHub (pinned to bf88c9f9a8)

Solutions

  1. Make provides.templates a list in the preset manifest.

When it happens

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