{"record":{"id":"ba2e54c5c3ab91ae","repo":"coleam00/Archon","slug":"downloaded-yaml-is-empty-for-slug","errorCode":null,"errorMessage":"Downloaded YAML is empty for '${slug}'","messagePattern":"Downloaded YAML is empty for '(.+?)'","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/cli/src/commands/workflow.ts","lineNumber":5191,"sourceCode":"  }\n\n  console.log(`Run with: archon workflow run ${slug} \"<message>\"`);\n}\n\nasync function installSingleFile(\n  entry: MarketplaceEntryJson,\n  slug: string,\n  archonDir: string,\n  force: boolean | undefined,\n  existsSync: (p: string) => boolean,\n  mkdirSync: (p: string, opts: { recursive: boolean }) => void,\n  writeFileSync: (p: string, data: string) => void\n): Promise<void> {\n  const { owner, repo, path } = parseGitHubUrl(entry.sourceUrl);\n  const content = await downloadRawFile(owner, repo, path, entry.sha);\n\n  if (!content.trim()) {\n    throw new Error(`Downloaded YAML is empty for '${slug}'`);\n  }\n\n  const workflowsDir = join(archonDir, 'workflows');\n  const destPath = join(workflowsDir, `${slug}.yaml`);\n\n  if (existsSync(destPath) && !force) {\n    throw new Error(`Workflow '${slug}' already exists at ${destPath}.\\nUse --force to overwrite.`);\n  }\n\n  mkdirSync(workflowsDir, { recursive: true });\n  writeFileSync(destPath, content);\n  console.log(`Installed '${entry.name}' to ${destPath}`);\n}\n\nasync function installDirectory(\n  entry: MarketplaceEntryJson,\n  slug: string,\n  archonDir: string,","sourceCodeStart":5173,"sourceCodeEnd":5209,"githubUrl":"https://github.com/coleam00/Archon/blob/0773b9745896ef0612e709c80845a0f7db315b19/packages/cli/src/commands/workflow.ts#L5173-L5209","documentation":"After downloading the workflow YAML for an install, the command verifies the content is not blank before writing it. An empty (whitespace-only) body from raw.githubusercontent.com would otherwise produce a useless zero-content workflow file, so it fails loudly with the slug named.","triggerScenarios":"`installSingleWorkflowFile` downloads via `downloadRawFile` and `content.trim()` is empty — e.g. the file at the pinned SHA is empty, or the fetch silently returned an empty body (rare transport/edge cases).","commonSituations":"Repo contains an intentionally empty placeholder workflow; the marketplace entry points at an empty file (wrong path resolved); an interrupted write upstream left an empty file at that SHA; odd CDN edge serving an empty body.","solutions":["Check the file at the pinned SHA: `gh api repos/<owner>/<repo>/contents/<path>?ref=<sha>` — is it empty?","Fix the marketplace entry's sha/path to point at the real non-empty workflow file","Re-push the workflow content upstream and update the entry's SHA","Retry in case a transient fetch glitch returned an empty body"],"exampleFix":"// before\nif (!content.trim()) throw new Error(`Downloaded YAML is empty for '${slug}'`);\n// after\nconst yaml = await parseYaml(content); // parse instead of just trimming\nif (!content.trim() || typeof yaml !== 'object') {\n  throw new Error(`Downloaded YAML is empty or unparseable for '${slug}' (sha ${entry.sha})`);\n}","handlingStrategy":"validation","validationCode":"const head = await fetch(`https://api.github.com/repos/${owner}/${repo}/contents/${path}?ref=${sha}`);\nconst meta = await head.json();\nif (meta.size === 0) throw new Error(`Workflow file ${path}@${sha} is empty upstream`);","typeGuard":"function isNonEmptyYaml(content: string): boolean {\n  return content.trim().length > 0;\n}","tryCatchPattern":"try {\n  await workflowInstallCommand(slug);\n} catch (e) {\n  if (e instanceof Error && e.message.includes('Downloaded YAML is empty')) {\n    // fix marketplace sha/path or re-push content upstream\n  } else throw e;\n}","preventionTips":["Never publish empty placeholder workflow files in marketplace repos","Verify pinned SHAs contain real content before registering entries","Keep marketplace paths pointed at maintained files, not stale shas","Retry once on odd empty responses to rule out transient fetch glitches"],"tags":["validation","github","empty-content","marketplace"],"backgroundTag":"empty-download-content","analyzedSha":"0773b9745896ef0612e709c80845a0f7db315b19","analyzedAt":"2026-09-01T02:28:07.064Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}