{"record":{"id":"b132f043284557d6","repo":"calesthio/OpenMontage","slug":"pexels-api-key-not-set-get-a-free-key-at-https","errorCode":null,"errorMessage":"PEXELS_API_KEY not set. Get a free key at https://www.pexels.com/api/ and add it to .env.","messagePattern":"PEXELS_API_KEY not set\\. Get a free key at https://www\\.pexels\\.com/api/ and add it to \\.env\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"tools/video/stock_sources/pexels.py","lineNumber":106,"sourceCode":"\n        with requests.get(\n            candidate.download_url, stream=True, timeout=120\n        ) as r:\n            r.raise_for_status()\n            with open(out_path, \"wb\") as f:\n                for chunk in r.iter_content(chunk_size=1 << 16):\n                    if chunk:\n                        f.write(chunk)\n        return out_path\n\n    # ------------------------------------------------------------------\n    # Internals\n    # ------------------------------------------------------------------\n\n    def _headers(self) -> dict[str, str]:\n        key = os.environ.get(\"PEXELS_API_KEY\")\n        if not key:\n            raise RuntimeError(\n                \"PEXELS_API_KEY not set. Get a free key at \"\n                \"https://www.pexels.com/api/ and add it to .env.\"\n            )\n        return {\"Authorization\": key}\n\n    def _search_videos(\n        self, query: str, filters: SearchFilters\n    ) -> list[Candidate]:\n        import requests  # lazy\n\n        params: dict[str, Any] = {\n            \"query\": query,\n            \"per_page\": max(1, min(filters.per_page, 80)),\n            \"page\": max(1, filters.page),\n        }\n        if filters.orientation:\n            params[\"orientation\"] = filters.orientation\n","sourceCodeStart":88,"sourceCodeEnd":124,"githubUrl":"https://github.com/calesthio/OpenMontage/blob/95e1c3d0ab93482159818560f6a8c8e866b9139f/tools/video/stock_sources/pexels.py#L88-L124","documentation":"Error \"PEXELS_API_KEY not set. Get a free key at https://www.pexels.com/api/ and add it to .env.\" thrown in calesthio/OpenMontage.","triggerScenarios":"The Pexels stock source is used without PEXELS_API_KEY set in the environment.","commonSituations":"See trigger scenarios.","solutions":["Get a free API key at https://www.pexels.com/api/ and set PEXELS_API_KEY in the environment or .env file.","Restart the process after adding the key so the environment is reloaded."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"95e1c3d0ab93482159818560f6a8c8e866b9139f","analyzedAt":"2026-08-15T06:31:20.014Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}