jackwener/OpenCLI · error · CommandExecutionError

network error fetching signed URL: ${e.message}

Error message

network error fetching signed URL: ${e.message}

What it means

A CommandExecutionError thrown when Node's fetch of the pre-signed CDN URL rejects (network-level failure, not an HTTP error status). Because the URL is pre-signed, no auth headers are needed; a rejection means DNS, TLS, connectivity, or an invalid/unfetchable URL rather than a 4xx/5xx response.

Source

Thrown at clis/slock/attachment-download.js:64

    await page.goto(SLOCK_HOME_URL);
    const snippet = buildFetchSnippet({
      method: 'GET',
      path: `/attachments/${encodeURIComponent(id)}/url`,
      serverScoped: true,
      serverIdOverride: kwargs.server,
    });
    const result = await page.evaluate(`(async () => { ${snippet} })()`);
    const rows = dispatchEvaluateResult(result);
    const data = Array.isArray(rows) ? rows[0] : rows;
    const url = data?.url;
    if (!url) throw new CommandExecutionError(`no signed url returned for attachment ${id}`);

    // Step 2 — Node side, fetch the bytes from the signed CDN URL. No auth
    // header (URL is pre-signed); no Origin (Node fetch has none) so CORS
    // isn't in play.
    let res;
    try { res = await fetch(url); }
    catch (e) { throw new CommandExecutionError(`network error fetching signed URL: ${e.message}`); }
    if (!res.ok) {
      throw new CommandExecutionError(`HTTP ${res.status} from signed CDN URL while downloading ${id}`);
    }
    const ab = await res.arrayBuffer();
    fs.writeFileSync(out, Buffer.from(ab));
    return [{ attachmentId: id, out, sizeBytes: ab.byteLength }];
  },
});

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Check basic network connectivity to the CDN host (curl the signed URL from the same machine)
  2. Fix proxy environment variables (HTTPS_PROXY/NO_PROXY) or corporate firewall rules for the CDN domain
  3. Retry — transient DNS or TLS failures often resolve on a second attempt
  4. Verify the signed URL is well-formed by logging it before fetching

Example fix

// before
catch (e) { throw new CommandExecutionError(`network error fetching signed URL: ${e.message}`); }
// after
catch (e) {
  if (e instanceof Error && e.message.includes('fetch failed')) {
    // hint: proxy/DNS — check connectivity to CDN host
  }
  throw new CommandExecutionError(`network error fetching signed URL: ${e.message}`);
}
Defensive patterns

Strategy: retry

Validate before calling

// reachability pre-check
try {
  await fetch('https://example-cdn.invalid/ping', { method: 'HEAD', signal: AbortSignal.timeout(5000) });
} catch { console.error('CDN host unreachable — check network/proxy/DNS'); }

Try / catch

try {
  await attachmentDownload(page, { attachmentId: id });
} catch (e) {
  if (/network error fetching signed URL/.test(e.message)) {
    await new Promise(r => setTimeout(r, 2000));
    return attachmentDownload(page, { attachmentId: id }); // one retry for transient DNS/TLS failures
  }
  throw e;
}

Prevention

When it happens

Trigger: The fetch(url) call throws — machine offline or behind a proxy blocking the CDN host, DNS resolution failure for the CDN domain, TLS certificate issues, IPv6 connectivity problems, or the signed URL being malformed (e.g. contains characters fetch cannot parse).

Common situations: Corporate proxy/firewall blocking the storage CDN domain; VPN or DNS misconfiguration; expired signed URL is not the cause here (that yields HTTP 403, caught by the res.ok branch); Node without network access in a container/sandbox.

Related errors


AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29). Data as JSON: /api/errors/a3e73b49a19a1a7c. Report an issue: GitHub.