github/spec-kit · error · TemplateResolutionError

Wrap layer {path} is missing {placeholder}

Error message

Wrap layer {path} is missing {placeholder}

What it means

During template layer composition, a layer whose manifest declares strategy "wrap" must contain the literal placeholder {CORE_TEMPLATE} marking where the accumulated base content is inserted. If the wrap layer file lacks that token, composition cannot proceed and TemplateResolutionError is raised naming the layer path.

Source

Thrown at scripts/python/common.py:464

    """Resolve and compose template content through the project layer stack."""
    if not _is_safe_component(template_name):
        return None

    layers: list[tuple[Path, str]] = []

    def compose_from_base() -> str:
        try:
            content = layers[-1][0].read_bytes().decode("utf-8")
            for path, strategy in reversed(layers[:-1]):
                layer_content = path.read_bytes().decode("utf-8")
                if strategy == "prepend":
                    content = f"{layer_content}\n\n{content}"
                elif strategy == "append":
                    content = f"{content}\n\n{layer_content}"
                elif strategy == "wrap":
                    placeholder = "{CORE_TEMPLATE}"
                    if placeholder not in layer_content:
                        raise TemplateResolutionError(
                            f"Wrap layer {path} is missing {placeholder}"
                        )
                    content = layer_content.replace(placeholder, content)
                else:
                    raise TemplateResolutionError(
                        f"Unknown template composition strategy '{strategy}' in {path}"
                    )
        except (OSError, UnicodeError) as exc:
            raise TemplateResolutionError(
                f"Failed to read template layer for '{template_name}': {exc}"
            ) from exc
        return content

    override = (
        repo_root
        / ".specify"
        / "templates"
        / "overrides"

View on GitHub (pinned to bf88c9f9a8)

Solutions

  1. Open the layer file named in the error and add the exact token {CORE_TEMPLATE} at the point where the base template content should be inserted.
  2. Verify the spelling and that there are no surrounding spaces inside the braces ({CORE_TEMPLATE}, not { CORE_TEMPLATE }).
  3. If you intended the layer to go before/after the base instead, change the manifest strategy to prepend or append, which need no placeholder.

Example fix

# before — wrap layer body
# My team header
{CORE_TEMPLATE }
# after
# My team header
{CORE_TEMPLATE}
Defensive patterns

Strategy: validation

Validate before calling

from pathlib import Path

def wrap_layer_is_valid(layer: Path) -> bool:
    try:
        return "{CORE_TEMPLATE}" in layer.read_text(encoding="utf-8")
    except OSError:
        return False

# before composing
if any(s == "wrap" and not wrap_layer_is_valid(p) for p, s in wrap_layers):
    print("wrap layer missing {CORE_TEMPLATE}; fix or downgrade to prepend")

Try / catch

try:
    content = resolve_template_content(name, repo_root)
except TemplateResolutionError as exc:
    if "missing {CORE_TEMPLATE}" in str(exc):
        raise SystemExit(f"Fix the wrap layer named in: {exc}") from exc
    raise

Prevention

When it happens

Trigger: A preset/override layer manifest sets strategy: wrap but the layer markdown file never includes {CORE_TEMPLATE}; or the placeholder was edited to {CORE-TEMPLATE}, {CORE_TEMPLATE } (extra spaces), or placed inside a code fence that was later reformatted away.

Common situations: Authoring a custom wrap preset and forgetting the placeholder; tools/editors that 'tidy' braces or template linters that strip unknown mustache-like tokens; renaming the placeholder during a copy-paste from another template system.

Related errors


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