github/spec-kit · error · PresetValidationError

Each template entry in 'provides.templates' must be a mappin

Error message

Each template entry in 'provides.templates' must be a mapping

What it means

Error "Each template entry in 'provides.templates' must be a mapping" thrown in github/spec-kit.

Source

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

        # 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
            # PresetValidationError and so escapes the callers that handle a
            # malformed manifest. The sibling extension manifest already
            # rejects a non-string command 'file' via
            # relative_extension_path_violation().
            for field in ("type", "name", "file"):
                if not isinstance(tmpl[field], str):
                    raise PresetValidationError(
                        f"Invalid template {field}: expected a string, "
                        f"got {type(tmpl[field]).__name__}"

View on GitHub (pinned to bf88c9f9a8)

Solutions

  1. Make each provides.templates entry a mapping with type/name/file fields.

When it happens

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