{"record":{"id":"4cf70b1e07d77435","repo":"davila7/claude-code-templates","slug":"warning-could-not-fetch-category-item-name","errorCode":null,"errorMessage":"Warning: Could not fetch category ${item.name}:","messagePattern":"Warning: Could not fetch category (.+?):","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"cli-tool/src/index.js","lineNumber":1506,"sourceCode":"        });\n      } else if (item.type === 'dir') {\n        // Category directory, fetch its contents\n        try {\n          const categoryResponse = await fetch(`https://api.github.com/repos/davila7/claude-code-templates/contents/cli-tool/components/agents/${item.name}`);\n          if (categoryResponse.ok) {\n            const categoryContents = await categoryResponse.json();\n            for (const categoryItem of categoryContents) {\n              if (categoryItem.type === 'file' && categoryItem.name.endsWith('.md')) {\n                agents.push({\n                  name: categoryItem.name.replace('.md', ''),\n                  path: `${item.name}/${categoryItem.name.replace('.md', '')}`,\n                  category: item.name\n                });\n              }\n            }\n          }\n        } catch (error) {\n          console.warn(`Warning: Could not fetch category ${item.name}:`, error.message);\n        }\n      }\n    }\n    \n    return agents;\n  } catch (error) {\n    console.warn('Warning: Could not fetch agents, using fallback list');\n    // Comprehensive fallback list if all methods fail\n    return [\n      { name: 'frontend-developer', path: 'development-team/frontend-developer', category: 'development-team' },\n      { name: 'backend-developer', path: 'development-team/backend-developer', category: 'development-team' },\n      { name: 'fullstack-developer', path: 'development-team/fullstack-developer', category: 'development-team' },\n      { name: 'api-security-audit', path: 'api-security-audit', category: 'root' },\n      { name: 'database-optimization', path: 'database-optimization', category: 'root' },\n      { name: 'react-performance-optimization', path: 'react-performance-optimization', category: 'root' }\n    ];\n  }\n}","sourceCodeStart":1488,"sourceCodeEnd":1524,"githubUrl":"https://github.com/davila7/claude-code-templates/blob/a0851ed10c7c60463dac8cfaaca124cf32d5804d/cli-tool/src/index.js#L1488-L1524","documentation":"While fetching the catalog of agents from the GitHub API (repo contents per category), each per-category request is wrapped in its own try/catch; this warning fires when one category's fetch fails (rate limit 403, network error, or a category folder that returns an unexpected shape). Other categories still load, so the resulting agent list is only partially populated.","triggerScenarios":"Calling getAvailableAgents() when one of the per-category `gh` API calls fails: GitHub secondary rate limits during bursts, a flaky network, an HTTP 403 with x-ratelimit-remaining: 0, or a category name that returns a non-array JSON body.","commonSituations":"CI pipelines hammering the GitHub unauthenticated API (60 req/hr limit), corporate proxies/firewalls dropping requests, or a renamed/removed category directory in the repo making the response shape unexpected.","solutions":["Wait for the rate-limit window to reset (check x-ratelimit-reset) or supply a GITHUB_TOKEN to lift the limit to 5000/hr.","Retry with backoff around the fetch call for transient 5xx/network errors.","Verify network access to api.github.com (curl -I https://api.github.com) if behind a proxy.","Check the repo layout — a category that no longer exists yields responses the parser can't handle."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"if (res.status === 403 && res.headers.get('x-ratelimit-remaining') === '0') await sleepUntilReset(res.headers.get('x-ratelimit-reset'));","typeGuard":"Array.isArray(data) ? data : []","tryCatchPattern":"catch (e) { if (isRetryable(e)) await backoffRetry(fetchCategory, item.name); else console.warn(`Could not fetch category ${item.name}`, e.message); }","preventionTips":["Authenticate GitHub API calls with a token to lift rate limits.","Honor x-ratelimit-reset headers before retrying.","Cache category listings between runs."],"tags":["github-api","rate-limit","network"],"backgroundTag":"github-api-rate-limited","analyzedSha":"a0851ed10c7c60463dac8cfaaca124cf32d5804d","analyzedAt":"2026-08-28T14:11:56.058Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}