{"record":{"id":"8062ee511d43c9fd","repo":"upstash/context7","slug":"downloaddata-error-no-files","errorCode":null,"errorMessage":"downloadData.error || \"no files\"","messagePattern":"downloadData\\.error \\|\\| \"no files\"","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"packages/cli/src/commands/setup.ts","lineNumber":368,"sourceCode":"    const result = await installRule(agentName, \"mcp\", scope);\n    ruleStatus = result.status;\n    rulePath = result.path;\n  } catch (err) {\n    ruleStatus = `failed: ${err instanceof Error ? err.message : String(err)}`;\n    rulePath = \"\";\n  }\n\n  const skillDir =\n    scope === \"global\"\n      ? agent.skill.dir(\"global\")\n      : join(process.cwd(), agent.skill.dir(\"project\"));\n  const skillPath = join(skillDir, agent.skill.name, \"SKILL.md\");\n\n  let skillStatus: string;\n  try {\n    const downloadData = await downloadSkill(\"/upstash/context7\", agent.skill.name);\n    if (downloadData.error || downloadData.files.length === 0) {\n      throw new Error(downloadData.error || \"no files\");\n    }\n    await installSkillFiles(agent.skill.name, downloadData.files, skillDir);\n    skillStatus = \"installed\";\n  } catch (err) {\n    skillStatus = `failed: ${err instanceof Error ? err.message : String(err)}`;\n  }\n\n  return {\n    agent: agent.displayName,\n    mcpStatus,\n    mcpPath,\n    ruleStatus,\n    rulePath,\n    skillStatus,\n    skillPath,\n  };\n}\n","sourceCodeStart":350,"sourceCodeEnd":386,"githubUrl":"https://github.com/upstash/context7/blob/5284672feb575908efead6fcf1b5e542f8d607bb/packages/cli/src/commands/setup.ts#L350-L386","documentation":"Thrown by the CLI `setup` command after `downloadSkill(\"/upstash/context7\", ...)` returns a non-empty `error` string or an empty `files` array. `downloadSkill` first calls the Context7 registry, then falls back to GitHub (`getSkillFromGitHub`, which needs GITHUB_TOKEN for private repos); failure at either stage collapses into `{ files: [], error }` instead of throwing. The error is caught immediately and shown as `skillStatus = \"failed: ...\"` in the setup summary, so MCP and rule configuration still complete.","triggerScenarios":"Running `context7 setup` while the registry API errors for /upstash/context7 AND the GitHub fallback fails (no GITHUB_TOKEN for a private repo, unauthenticated GitHub rate limit, repo renamed); being offline so both the API and GitHub tarball download fail; the GitHub tree download returning zero files.","commonSituations":"Corporate proxy or firewall blocking api.context7.com or codeload.github.com; missing GITHUB_TOKEN env var; GitHub secondary rate limits during heavy CI usage; transient GitHub outage during setup.","solutions":["Re-run `context7 setup` — GitHub rate limits and blips are usually transient","Check network reachability of the registry and github.com from this machine (proxy/VPN)","Set GITHUB_TOKEN if the skill source repo is private or rate-limited","Verify the skill still exists at github.com/upstash/context7","Continue without the skill (MCP config is already written) and create SKILL.md manually"],"exampleFix":"// before: unauthenticated GitHub fallback gets rate-limited\ndownloadSkill(\"/upstash/context7\", skillName);\n\n// after: export a token so the fallback path is authenticated\n//   export GITHUB_TOKEN=$(gh auth token)\ndownloadSkill(\"/upstash/context7\", skillName);","handlingStrategy":"fallback","validationCode":"// Pre-check reachability before running setup\nimport { request } from 'undici';\nasync function canReachRegistry(baseUrl: string): Promise<boolean> {\n  try { const r = await request(baseUrl + '/ping', { method: 'GET' }); return r.statusCode < 500; }\n  catch { return false; }\n}","typeGuard":null,"tryCatchPattern":"try {\n  const data = await downloadSkill('/upstash/context7', skillName);\n  if (data.error || data.files.length === 0) throw new Error(data.error || 'no files');\n  await installSkillFiles(skillName, data.files, skillDir);\n} catch (err) {\n  // Non-fatal: MCP config already written; fall back to manual SKILL.md\n  console.warn(`skill install skipped: ${err instanceof Error ? err.message : err}`);\n}","preventionTips":["Set GITHUB_TOKEN in CI before running context7 setup","Keep the skill optional in automation — treat a failed skill install as a warning, not a pipeline failure","Pin and cache the SKILL.md content locally if offline builds matter"],"tags":["cli","setup","skill-download","github","network"],"backgroundTag":"empty-download-result","analyzedSha":"5284672feb575908efead6fcf1b5e542f8d607bb","analyzedAt":"2026-08-18T18:00:18.510Z","schemaVersion":2},"datasetVersion":"2026-08-24T22:17:12.610Z"}