{"record":{"id":"4e76034bbdb99d16","repo":"crewAIInc/crewAI","slug":"failed-to-fetch-templates-from-github-e","errorCode":null,"errorMessage":"Failed to fetch templates from GitHub: {e}","messagePattern":"Failed to fetch templates from GitHub: (.+?)","errorType":"console","errorClass":"SystemExit","httpStatus":null,"severity":"error","filePath":"lib/cli/src/crewai_cli/remote_template/main.py","lineNumber":170,"sourceCode":"        console.print(panel)\n\n    def _fetch_templates(self) -> list[dict[str, Any]]:\n        \"\"\"Fetch all template repos from the GitHub org.\"\"\"\n        templates: list[dict[str, Any]] = []\n        page = 1\n        while True:\n            url = f\"{GITHUB_API_BASE}/orgs/{GITHUB_ORG}/repos\"\n            params: dict[str, str | int] = {\n                \"per_page\": 100,\n                \"page\": page,\n                \"type\": \"public\",\n            }\n            try:\n                response = httpx.get(url, params=params, timeout=15)\n                response.raise_for_status()\n            except httpx.HTTPError as e:\n                click.secho(f\"Failed to fetch templates from GitHub: {e}\", fg=\"red\")\n                raise SystemExit(1) from e\n\n            repos = response.json()\n            if not repos:\n                break\n\n            templates.extend(\n                repo\n                for repo in repos\n                if repo[\"name\"].startswith(TEMPLATE_PREFIX) and not repo.get(\"private\")\n            )\n\n            page += 1\n\n        templates.sort(key=lambda r: r[\"name\"])\n        return templates\n\n    def _resolve_repo_name(self, name: str) -> str | None:\n        \"\"\"Resolve user input to a full repo name, or None if not found.\"\"\"","sourceCodeStart":152,"sourceCodeEnd":188,"githubUrl":"https://github.com/crewAIInc/crewAI/blob/754d7323beb2fd042e33444a115ea2d5a47193f0/lib/cli/src/crewai_cli/remote_template/main.py#L152-L188","documentation":"Raised while paginating through the GitHub API (`/orgs/{GITHUB_ORG}/repos`) to build the template catalog for `crewai template list/add`. Any httpx.HTTPError — connection failure, timeout (15s), DNS failure, or an HTTP status error from raise_for_status() (403 rate-limit, 5xx) — triggers it. The CLI prints the red message and exits 1, chaining the original exception.","triggerScenarios":"GET https://api.github.com/orgs/crewAIInc/repos?per_page=100&page=N with timeout=15 failing: no network, corporate proxy blocking api.github.com, GitHub secondary rate limits returning 403/429 (raise_for_status raises HTTPStatusError, an httpx.HTTPError subclass), or GitHub 5xx incidents.","commonSituations":"CI runners behind restrictive firewalls/proxies needing HTTP(S)_PROXY env vars; scripts hitting `crewai template list` in a loop until GitHub's unauthenticated rate limit (60 req/hr per IP) is exhausted; air-gapped environments; transient GitHub outages.","solutions":["Check connectivity: `curl -I https://api.github.com/orgs/crewAIInc/repos` from the same machine.","If behind a proxy, set HTTPS_PROXY/HTTP_PROXY (httpx honors these env vars).","If rate-limited (403/429 in the message), wait or set GITHUB_API_TOKEN-style auth if the CLI/deployment supports it, and reduce how often the listing runs.","Retry after a short wait for transient 5xx/network blips."],"exampleFix":"# before\n$ crewai template list\n# Failed to fetch templates from GitHub: Client error '403 Forbidden' ...\n\n# after\n$ export HTTPS_PROXY=http://proxy.corp:8080  # or wait out the rate limit\n$ crewai template list","handlingStrategy":"retry","validationCode":"import httpx\n\nresp = httpx.get(\n    \"https://api.github.com/orgs/crewAIInc/repos\",\n    params={\"per_page\": 1, \"page\": 1, \"type\": \"public\"},\n    timeout=15,\n)\nresp.raise_for_status()  # probe before running the CLI command","typeGuard":null,"tryCatchPattern":"import time, httpx\n\nfor attempt in range(3):\n    try:\n        run_template_list()\n        break\n    except SystemExit as e:\n        # transient GitHub 5xx / rate limits: back off and retry\n        time.sleep(2 ** attempt)\nelse:\n    raise","preventionTips":["Cache the template list in automation instead of calling `crewai template list` repeatedly.","Configure proxy env vars (HTTPS_PROXY) in corporate networks before invoking the CLI.","Watch for 403/429 in the message — that is rate limiting, not connectivity; space out calls."],"tags":["network","httpx","github-api","rate-limit","template"],"backgroundTag":null,"analyzedSha":"754d7323beb2fd042e33444a115ea2d5a47193f0","analyzedAt":"2026-08-15T04:06:56.746Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}