coleam00/Archon · error

Cannot fetch ${rawUrl}: ${err.message}

Error message

Cannot fetch ${rawUrl}: ${err.message}

What it means

Wraps a network-level failure of `fetch()` against raw.githubusercontent.com. Before any HTTP status exists, transport errors (DNS, TLS, connection refused/reset, aborts) surface as thrown exceptions; this catch rethrows them with the failing URL and the original message so callers can tell which source file could not be reached.

Source

Thrown at packages/cli/src/commands/workflow.ts:5128

    throw new Error(`Expected directory listing from ${url}, got a single file`);
  }
  return data as GitHubContentItem[];
}

/** Download a file from raw.githubusercontent.com at a pinned SHA. */
async function downloadRawFile(
  owner: string,
  repo: string,
  filePath: string,
  sha: string
): Promise<string> {
  const rawUrl = `https://raw.githubusercontent.com/${owner}/${repo}/${sha}/${filePath}`;
  let res: Response;
  try {
    res = await fetch(rawUrl);
  } catch (error) {
    const err = error as Error;
    throw new Error(`Cannot fetch ${rawUrl}: ${err.message}`);
  }
  if (!res.ok) {
    throw new Error(`Source fetch failed: HTTP ${String(res.status)} from ${rawUrl}`);
  }
  return res.text();
}

export async function workflowInstallCommand(
  slug: string,
  cwd: string,
  force?: boolean
): Promise<void> {
  const entries = await fetchMarketplace();
  const entry = entries.find(e => e.slug === slug);

  if (!entry) {
    console.error(`Error: Workflow '${slug}' not found in marketplace.`);
    console.error("Run 'archon workflow search' to browse available workflows.");

View on GitHub (pinned to 0773b97458)

Solutions

  1. Check network connectivity / DNS (`ping raw.githubusercontent.com`, `curl -I <rawUrl>`)
  2. Configure proxy env vars (HTTPS_PROXY) or unset a bad proxy
  3. Retry the install; transient resets often clear on a second attempt
  4. If behind a strict firewall, allowlist raw.githubusercontent.com

Example fix

// before
try { res = await fetch(rawUrl); } catch (e) { throw new Error(`Cannot fetch ${rawUrl}: ${e.message}`); }
// after
try {
  res = await fetch(rawUrl, { signal: AbortSignal.timeout(30000) });
} catch (e) {
  throw new Error(`Cannot fetch ${rawUrl}: ${e.message}`);
}
Defensive patterns

Strategy: retry

Validate before calling

// Pre-check reachability before install
const probe = await fetch('https://raw.githubusercontent.com/github/gitignore/main/README.md', { method: 'HEAD' }).catch(() => null);
if (!probe) throw new Error('raw.githubusercontent.com unreachable — check network/proxy');

Type guard

function isNetworkError(e: unknown): e is TypeError {
  return e instanceof TypeError && /fetch|network|ENOTFOUND|ECONNREFUSED/i.test(String((e as Error).cause ?? e.message));
}

Try / catch

try {
  await workflowInstallCommand(slug);
} catch (e) {
  if (e instanceof Error && e.message.startsWith('Cannot fetch')) {
    // transport-level failure: check network/proxy, retry with backoff
  } else throw e;
}

Prevention

When it happens

Trigger: `downloadRawFile(owner, repo, sha, filePath)` calls `fetch(rawUrl)` and the promise rejects: no network, DNS failure, TLS error, connection reset, or request aborted. Any non-2xx HTTP response does NOT hit this — it goes to error 142 instead.

Common situations: Offline or firewalled environment, corporate proxy blocking raw.githubusercontent.com, DNS misconfiguration, VPN down, transient network blip, IPv6 issues in CI containers.

Related errors


AI-assisted analysis of coleam00/Archon@0773b97458 (2026-09-01). Data as JSON: /api/errors/e94a0482d9d1aed7. Report an issue: GitHub.