{"record":{"id":"f6fcd10901ba6bb6","repo":"home-assistant/core","slug":"invalid-blueprint-msg-or-exc","errorCode":null,"errorMessage":"Invalid blueprint: {msg_or_exc}","messagePattern":"Invalid blueprint: (.+?)","errorType":"exception","errorClass":"InvalidBlueprint","httpStatus":null,"severity":"error","filePath":"homeassistant/components/blueprint/models.py","lineNumber":63,"sourceCode":"from .schemas import BLUEPRINT_INSTANCE_FIELDS\n\n\nclass Blueprint:\n    \"\"\"Blueprint of a configuration structure.\"\"\"\n\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","sourceCodeStart":45,"sourceCodeEnd":81,"githubUrl":"https://github.com/home-assistant/core/blob/58a3fdb3ea0538617f0a07efcfba6294de64fd59/homeassistant/components/blueprint/models.py#L45-L81","documentation":"InvalidBlueprint is raised from Blueprint.__init__ when the blueprint data fails the voluptuous schema (BLUEPRINT_SCHEMA or the automation/script-specific schema). The vol.Invalid is humanized via humanize_error so the message names the offending key. It is a data-shape problem in the YAML file itself, not an I/O problem.","triggerScenarios":"Loading a blueprint YAML missing the top-level 'blueprint:' mapping, a missing 'name', missing 'domain', an 'input:' section that is not a mapping, or a value of the wrong type; triggered by async_get_blueprint, _load_blueprints at startup, or importing a URL whose YAML is malformed.","commonSituations":"Hand-edited blueprint file with a typo; YAML indentation error turning 'blueprint:' into a string; a script blueprint missing 'sequence'; blueprints written for an older HA schema after a breaking change.","solutions":["Read the humanized message: it names the exact key/path that failed (e.g. 'required key not provided @ data['blueprint']['name']')","Open config/blueprints/<domain>/<file>.yaml and fix the reported key against the schema: blueprint.name, blueprint.domain, and a mapping under input:","Validate the file as plain YAML first (python -c \"import yaml,sys; yaml.safe_load(open(sys.argv[1]))\") to rule out syntax errors","Re-import the blueprint from its original source URL to get a known-good copy"],"exampleFix":"# before (blueprint YAML)\nblueprint:\n  domain: automation\n  # name missing\ninput: {}\n\n# after\nblueprint:\n  name: My blueprint\n  domain: automation\ninput: {}","handlingStrategy":"validation","validationCode":"import voluptuous as vol\nfrom homeassistant.components.blueprint.models import BLUEPRINT_SCHEMA\n\ndef blueprint_valid(data: dict) -> bool:\n    try:\n        BLUEPRINT_SCHEMA(data)\n        return True\n    except vol.Invalid:\n        return False","typeGuard":null,"tryCatchPattern":"from homeassistant.components.blueprint.errors import InvalidBlueprint\ntry:\n    bp = Blueprint(data, expected_domain=\"automation\", schema=BLUEPRINT_SCHEMA)\nexcept InvalidBlueprint as err:\n    logger.warning(\"Rejected blueprint %s: %s\", err.blueprint_name, err)","preventionTips":["Run BLUEPRINT_SCHEMA over edited YAML before saving","Keep blueprints under source control so a bad edit is diffable and revertible"],"tags":["blueprint","yaml","voluptuous","validation"],"backgroundTag":null,"analyzedSha":"58a3fdb3ea0538617f0a07efcfba6294de64fd59","analyzedAt":"2026-08-14T20:54:38.818Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}