home-assistant/core · warning · BlueprintInUse
Blueprint in use
Error message
Blueprint in use
What it means
BlueprintInUse is raised by async_remove_blueprint when the manager detects the blueprint path is still referenced by an active automation or script (via _blueprint_in_use). Deletion is refused to avoid leaving consumers pointing at a missing file.
Source
Thrown at homeassistant/components/blueprint/models.py:327
) -> BlueprintInputs:
"""Process a blueprint config."""
try:
config_with_blueprint = BLUEPRINT_INSTANCE_FIELDS(config_with_blueprint)
except vol.Invalid as err:
raise InvalidBlueprintInputs(
self.domain, humanize_error(config_with_blueprint, err)
) from err
bp_conf = config_with_blueprint[CONF_USE_BLUEPRINT]
blueprint = await self.async_get_blueprint(bp_conf[CONF_PATH])
inputs = BlueprintInputs(blueprint, config_with_blueprint)
inputs.validate()
return inputs
async def async_remove_blueprint(self, blueprint_path: str) -> None:
"""Remove a blueprint file."""
if self._blueprint_in_use(self.hass, blueprint_path):
raise BlueprintInUse(self.domain, blueprint_path)
path = self.blueprint_folder / blueprint_path
await self.hass.async_add_executor_job(path.unlink)
self._blueprints[blueprint_path] = None
def _create_file(
self, blueprint: Blueprint, blueprint_path: str, allow_override: bool
) -> bool:
"""Create blueprint file.
Returns true if the action overrides an existing blueprint.
"""
path = pathlib.Path(
self.hass.config.path(BLUEPRINT_FOLDER, self.domain, blueprint_path)
)
exists = path.exists()
if not allow_override and exists:View on GitHub (pinned to 58a3fdb3ea)
Solutions
- Find and delete (or re-point) every automation/script using the blueprint — the blueprint's UI page lists its 'usages'
- Then retry the delete
- Alternatively keep the blueprint; the error is intentional protection, not corruption
Defensive patterns
Strategy: try-catch
Try / catch
from homeassistant.components.blueprint.errors import BlueprintInUse
try:
await manager.async_remove_blueprint(path)
except BlueprintInUse:
# list usages and ask the user to delete/re-point them first Prevention
- Check the blueprint's 'usages' list in the UI before deleting
- Automate cleanup: remove consuming automations in the same script that deletes the blueprint
When it happens
Trigger: Calling the bluetooth-style delete path — i.e. the blueprint/delete or blueprint/import websocket with delete-first semantics, or async_remove_blueprint — while at least one automation/script config contains use_blueprint.path equal to this blueprint.
Common situations: User tries to delete a blueprint from the UI without first removing the automations built from it; automations in a disabled state still count as references.
Related errors
- Item {item_id} preferred.
- err
- No valid blueprint found in the topic. Blueprint syntax bloc
- No valid blueprint found in the gist. The blueprint file nee
- Unsupported URL
AI-assisted analysis of home-assistant/core@58a3fdb3ea (2026-08-14).
Data as JSON: /api/errors/2f8b118a7dcc9e63.
Report an issue: GitHub.