calesthio/OpenMontage · error · RuntimeError

UNSPLASH_ACCESS_KEY not set. Create an app at https://unspla

Error message

UNSPLASH_ACCESS_KEY not set. Create an app at https://unsplash.com/documentation and add the access key to .env.

What it means

Error "UNSPLASH_ACCESS_KEY not set. Create an app at https://unsplash.com/documentation and add the access key to .env." thrown in calesthio/OpenMontage.

Source

Thrown at tools/video/stock_sources/unsplash.py:97

        out_path.parent.mkdir(parents=True, exist_ok=True)

        with requests.get(
            candidate.download_url,
            stream=True,
            timeout=180,
            headers={"User-Agent": _USER_AGENT},
        ) as r:
            r.raise_for_status()
            with open(out_path, "wb") as f:
                for chunk in r.iter_content(chunk_size=1 << 16):
                    if chunk:
                        f.write(chunk)
        return out_path

    def _headers(self) -> dict[str, str]:
        key = os.environ.get("UNSPLASH_ACCESS_KEY")
        if not key:
            raise RuntimeError(
                "UNSPLASH_ACCESS_KEY not set. Create an app at "
                "https://unsplash.com/documentation and add the access key to .env."
            )
        return {
            "Authorization": f"Client-ID {key}",
            "Accept-Version": "v1",
            "User-Agent": _USER_AGENT,
        }


def _photo_to_candidate(photo: dict[str, Any], filters: SearchFilters) -> Candidate | None:
    width = int(photo.get("width") or 0)
    height = int(photo.get("height") or 0)
    if filters.min_width is not None and width and width < filters.min_width:
        return None
    if filters.orientation and not _matches_orientation(filters.orientation, width, height):
        return None

View on GitHub (pinned to 95e1c3d0ab)

Solutions

  1. Create an app at https://unsplash.com/documentation to obtain an access key, then set UNSPLASH_ACCESS_KEY in the environment or .env.
  2. Reload the environment (restart the process) after adding the key.

When it happens

Trigger: The Unsplash stock source is used without UNSPLASH_ACCESS_KEY set in the environment.

Common situations: See trigger scenarios.


AI-assisted analysis of calesthio/OpenMontage@95e1c3d0ab (2026-08-15). Data as JSON: /api/errors/4921403782ca6d17. Report an issue: GitHub.