home-assistant/core · error · InvalidBlueprint

Invalid blueprint: Found incorrect blueprint type {data_doma

Error message

Invalid blueprint: Found incorrect blueprint type {data_domain}, expected {expected_domain}

What it means

Raised when the blueprint's 'blueprint.domain' value does not match the expected_domain the loader passed in. The blueprint loader for the 'automation' folder only accepts automation blueprints, and the 'script' folder only script blueprints. This keeps a script blueprint from being loaded (and executed) as an automation.

Source

Thrown at homeassistant/components/blueprint/models.py:68

    def __init__(
        self,
        data: dict[str, Any],
        *,
        path: str | None = None,
        expected_domain: str | None = None,
        schema: Callable[[Any], Any],
    ) -> None:
        """Initialize a blueprint."""
        try:
            data = self.data = schema(data)
        except vol.Invalid as err:
            raise InvalidBlueprint(expected_domain, path, data, err) from err

        # In future, we will treat this as "incorrect" and allow to recover from this
        data_domain = data[CONF_BLUEPRINT][CONF_DOMAIN]
        if expected_domain is not None and data_domain != expected_domain:
            raise InvalidBlueprint(
                expected_domain,
                path or self.name,
                data,
                (
                    f"Found incorrect blueprint type {data_domain}, expected"
                    f" {expected_domain}"
                ),
            )

        self.domain = data_domain

        missing = yaml_util.extract_inputs(data) - set(self.inputs)

        if missing:
            raise InvalidBlueprint(
                data_domain,
                path or self.name,
                data,

View on GitHub (pinned to 58a3fdb3ea)

Solutions

  1. Move the file to the matching folder: domain 'script' belongs in config/blueprints/script/, domain 'automation' in config/blueprints/automation/
  2. Or edit the blueprint so blueprint.domain matches the folder it lives in
  3. After fixing, reload the automation/script integration or restart so the blueprint cache is rebuilt

Example fix

# before: file at config/blueprints/automation/my_bp.yaml
blueprint:
  name: Notify script
  domain: script

# after: move file to config/blueprints/script/my_bp.yaml (YAML unchanged)
Defensive patterns

Strategy: validation

Validate before calling

def domain_matches(data: dict, expected_domain: str) -> bool:
    return data.get("blueprint", {}).get("domain") == expected_domain

Try / catch

from homeassistant.components.blueprint.errors import InvalidBlueprint
try:
    Blueprint(data, expected_domain=domain, schema=schema)
except InvalidBlueprint as err:
    if "incorrect blueprint type" in str(err):
        # wrong folder: move file to the other domain's directory

Prevention

When it happens

Trigger: A YAML file placed in config/blueprints/automation/ whose body says 'domain: script' (or vice versa); importing a blueprint with the wrong domain selected; _load_blueprints scanning the domain folder at startup or reload.

Common situations: User downloaded a script blueprint and saved it into the automation blueprints directory; blueprint file moved between folders by hand; author changed the domain in the file but not its location.

Related errors


AI-assisted analysis of home-assistant/core@58a3fdb3ea (2026-08-14). Data as JSON: /api/errors/3a3c97d4ff1fdbdc. Report an issue: GitHub.