home-assistant/core · error · ServiceValidationError

cant_write

cant_write

Error message

Can't write to file, check logs for details.

What it means

Raised as a ServiceValidationError (translation key 'cant_write') when the underlying blinkpy call camera.save_recent_clips(output_dir=file_path) raises OSError. This means the path passed the allowlist check but the OS refused the write. The original OSError is chained via 'from err' and logged, hence 'check logs for details'.

Source

Thrown at homeassistant/components/blink/camera.py:178

            _LOGGER.debug("Could not retrieve image for %s", self._camera.name)
            return None
        except TypeError:
            _LOGGER.debug("No cached image for %s", self._camera.name)
            return None

    async def save_recent_clips(self, file_path) -> None:
        """Save multiple recent clips to output directory."""
        if not self.hass.config.is_allowed_path(file_path):
            raise ServiceValidationError(
                translation_domain=DOMAIN,
                translation_key="no_path",
                translation_placeholders={"target": file_path},
            )

        try:
            await self._camera.save_recent_clips(output_dir=file_path)
        except OSError as err:
            raise ServiceValidationError(
                translation_domain=DOMAIN,
                translation_key="cant_write",
            ) from err
        except UnauthorizedError as er:
            self.coordinator.config_entry.async_start_reauth(self.hass)
            raise ConfigEntryAuthFailed("Blink authorization failed") from er

    async def save_video(self, filename) -> None:
        """Handle save video service calls."""
        if not self.hass.config.is_allowed_path(filename):
            raise ServiceValidationError(
                translation_domain=DOMAIN,
                translation_key="no_path",
                translation_placeholders={"target": filename},
            )

        try:
            await self._camera.video_to_file(filename)

View on GitHub (pinned to 58a3fdb3ea)

Solutions

  1. Check the Home Assistant logs for the chained OSError to identify the exact syscall that failed
  2. Verify the directory exists and the HA process user can write to it: touch <dir>/.write_test from the same user/container
  3. Fix ownership/permissions (chown/chmod) on the host-side volume if running in Docker
  4. Free disk space or remount the external storage if it dropped out
Defensive patterns

Strategy: try-catch

Validate before calling

import os

def can_write_dir(path: str) -> bool:
    return os.path.isdir(path) and os.access(path, os.W_OK)

Try / catch

try:
    await hass.services.async_call(
        "blink", "save_recent_clips", {"file_path": path}, blocking=True
    )
except HomeAssistantError as err:
    if "cant_write" in str(err):
        _LOGGER.error("Clip write failed for %s; check permissions/disk", path)

Prevention

When it happens

Trigger: The allowlisted directory does not actually exist (blinkpy tries to create files in it), the directory is read-only or has wrong ownership/permissions for the Home Assistant process, the disk is full, or a filename collision/immutable flag causes an OSError during clip download and write.

Common situations: Allowlisted path points to a mount that is not mounted yet (NAS/unions), container user lacks write permission on the host-mounted volume, path exists but is a file not a directory, storage exhausted on long-running clip saves.

Related errors


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