{"record":{"id":"3a3c97d4ff1fdbdc","repo":"home-assistant/core","slug":"invalid-blueprint-found-incorrect-blueprint-type","errorCode":null,"errorMessage":"Invalid blueprint: Found incorrect blueprint type {data_domain}, expected {expected_domain}","messagePattern":"Invalid blueprint: Found incorrect blueprint type (.+?), expected (.+?)","errorType":"exception","errorClass":"InvalidBlueprint","httpStatus":null,"severity":"error","filePath":"homeassistant/components/blueprint/models.py","lineNumber":68,"sourceCode":"\n    def __init__(\n        self,\n        data: dict[str, Any],\n        *,\n        path: str | None = None,\n        expected_domain: str | None = None,\n        schema: Callable[[Any], Any],\n    ) -> None:\n        \"\"\"Initialize a blueprint.\"\"\"\n        try:\n            data = self.data = schema(data)\n        except vol.Invalid as err:\n            raise InvalidBlueprint(expected_domain, path, data, err) from err\n\n        # In future, we will treat this as \"incorrect\" and allow to recover from this\n        data_domain = data[CONF_BLUEPRINT][CONF_DOMAIN]\n        if expected_domain is not None and data_domain != expected_domain:\n            raise InvalidBlueprint(\n                expected_domain,\n                path or self.name,\n                data,\n                (\n                    f\"Found incorrect blueprint type {data_domain}, expected\"\n                    f\" {expected_domain}\"\n                ),\n            )\n\n        self.domain = data_domain\n\n        missing = yaml_util.extract_inputs(data) - set(self.inputs)\n\n        if missing:\n            raise InvalidBlueprint(\n                data_domain,\n                path or self.name,\n                data,","sourceCodeStart":50,"sourceCodeEnd":86,"githubUrl":"https://github.com/home-assistant/core/blob/58a3fdb3ea0538617f0a07efcfba6294de64fd59/homeassistant/components/blueprint/models.py#L50-L86","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Move the file to the matching folder: domain 'script' belongs in config/blueprints/script/, domain 'automation' in config/blueprints/automation/","Or edit the blueprint so blueprint.domain matches the folder it lives in","After fixing, reload the automation/script integration or restart so the blueprint cache is rebuilt"],"exampleFix":"# before: file at config/blueprints/automation/my_bp.yaml\nblueprint:\n  name: Notify script\n  domain: script\n\n# after: move file to config/blueprints/script/my_bp.yaml (YAML unchanged)","handlingStrategy":"validation","validationCode":"def domain_matches(data: dict, expected_domain: str) -> bool:\n    return data.get(\"blueprint\", {}).get(\"domain\") == expected_domain","typeGuard":null,"tryCatchPattern":"from homeassistant.components.blueprint.errors import InvalidBlueprint\ntry:\n    Blueprint(data, expected_domain=domain, schema=schema)\nexcept InvalidBlueprint as err:\n    if \"incorrect blueprint type\" in str(err):\n        # wrong folder: move file to the other domain's directory","preventionTips":["Store automation blueprints only under config/blueprints/automation and script blueprints under config/blueprints/script","Let the import dialog pick the folder instead of saving files by hand"],"tags":["blueprint","domain-mismatch","yaml"],"backgroundTag":null,"analyzedSha":"58a3fdb3ea0538617f0a07efcfba6294de64fd59","analyzedAt":"2026-08-14T20:54:38.818Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}