apify/crawlee · warning
${colors.yellow(`[${label}]`)}: Attempt ${attempt + 1} of ${
Error message
${colors.yellow(`[${label}]`)}: Attempt ${attempt + 1} of ${retries} failed, and will be retried What it means
This is a retry warning emitted by the generic `withRetries` wrapper in CreateProjectCommand. When the wrapped async function (e.g. `downloadTemplateFilesToDisk` used by the `create`/template download path) throws, the wrapper catches it, logs this warning via console.warn, waits 2500ms + (2500 * retries), and calls the function again until `retries` attempts are exhausted. It is not a thrown error; it signals a transient failure that the CLI is automatically recovering from.
Source
Thrown at packages/cli/src/commands/CreateProjectCommand.ts:51
}
async function withRetries<F extends (...args: unknown[]) => unknown>(
func: F,
retries: number,
label: string,
): Promise<Awaited<ReturnType<F>>> {
let attempt = 0;
let lastError: any;
while (attempt < retries) {
try {
return (await func()) as Awaited<ReturnType<F>>;
} catch (error: any) {
attempt++;
lastError = error;
if (attempt < retries) {
console.warn(
`${colors.yellow(`[${label}]`)}: Attempt ${attempt + 1} of ${retries} failed, and will be retried`,
error.message || error,
);
}
// Wait 2500ms + (2500 * retries) before giving up to give it some time between retries
await setTimeout(2500 + 2500 * attempt);
}
}
throw new Error(
`${colors.red(`[${label}]`)}: All ${retries} attempts failed, and will not be retried\n\n${
lastError.stack || lastError
}`,
);
}
async function downloadTemplateFilesToDisk(template: Template, destinationDirectory: string) {View on GitHub (pinned to dbe57fb09c)
Solutions
- Check network connectivity/proxy settings; if the underlying cause is fixed, retries will succeed on their own.
- Inspect the trailing `error.message` printed after the warning to identify the real root cause (e.g. ENOTFOUND, 403, EACCES).
- If failures are permanent, wait for the final failure after all retries and fix that root error instead of retrying.
- Use a stable network or retry the CLI command later; if GitHub is rate limiting, authenticate or wait before retrying.
Example fix
// before: transient network failure triggers warning npx apify create my-actor // fails mid-download behind a proxy // after: configure proxy so template download succeeds export HTTPS_PROXY=http://proxy.corp.local:8080 npx apify create my-actor
Defensive patterns
Strategy: retry
Validate before calling
// Before invoking the wrapped command, verify the network path is usable
if (!navigator.onLine) {
throw new Error('Network is offline; template download will fail and retry.');
}
const res = await fetch('https://api.github.com', { method: 'HEAD' });
if (!res.ok) console.warn('Template host unreachable; retries may exhaust.'); Try / catch
try {
await withRetries(() => downloadTemplateFilesToDisk(url, dir), { retries: 3, label: 'template-download' });
} catch (err) {
// Only reached after all retries are exhausted
console.error(`Template download failed after retries: ${err.message}`);
process.exitCode = 1;
} Prevention
- Run CLI scaffolding commands on a stable connection; avoid flaky VPNs/proxies for template downloads.
- Read the `error.message` appended after each retry warning to fix the root cause instead of letting retries exhaust.
- Configure HTTPS_PROXY correctly in corporate environments before running `create` commands.
When it happens
Trigger: A call to `withRetries(downloadTemplateFilesToDisk, ...)` (or any function wrapped by it during `create` project scaffolding) throws on an attempt where `attempt < retries` — typically a network fetch of template files failing (timeout, DNS, 5xx, socket reset) or a filesystem write error.
Common situations: Flaky corporate network or proxy blocking downloads of the project template from GitHub; npm registry or GitHub rate limiting; offline/VPN interruption while running `apify create`; antivirus or disk permissions intermittently blocking file writes to the target directory.
Related errors
- ${colors.red(`[${label}]`)}: All ${retries} attempts failed,
- <dynamic: message extracted from proxied error via getMessag
- Request blocked - received ${statusCode} status code.
- ${this.getMessageFromError(error)}
- ${status} - Error status code was set by user.
AI-assisted analysis of apify/crawlee@dbe57fb09c (2026-08-30).
Data as JSON: /api/errors/393de37b7816215e.
Report an issue: GitHub.