github/spec-kit · error · PresetValidationError

Invalid template type '{tmpl['type']}': must be one of {sort

Error message

Invalid template type '{tmpl['type']}': must be one of {sorted(VALID_PRESET_TEMPLATE_TYPES)}

What it means

Error "Invalid template type '{tmpl['type']}': must be one of {sorted(VALID_PRESET_TEMPLATE_TYPES)}" thrown in github/spec-kit.

Source

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

                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__}"
                    )

            if tmpl["type"] not in VALID_PRESET_TEMPLATE_TYPES:
                raise PresetValidationError(
                    f"Invalid template type '{tmpl['type']}': "
                    f"must be one of {sorted(VALID_PRESET_TEMPLATE_TYPES)}"
                )

            # Validate file path safety: must be relative, no parent traversal
            file_path = tmpl["file"]
            normalized = os.path.normpath(file_path)
            if os.path.isabs(normalized) or normalized.startswith(".."):
                raise PresetValidationError(
                    f"Invalid template file path '{file_path}': "
                    "must be a relative path within the preset directory"
                )

            # Validate strategy field (optional, defaults to "replace")
            strategy = tmpl.get("strategy", "replace")
            if not isinstance(strategy, str):
                raise PresetValidationError(
                    f"Invalid strategy value: must be a string, "

View on GitHub (pinned to bf88c9f9a8)

Solutions

  1. Set the template type to one of the supported preset template types.

When it happens

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