apify/crawlee · error · Error

${colors.red(`[${label}]`)}: All ${retries} attempts failed,

Error message

${colors.red(`[${label}]`)}: All ${retries} attempts failed, and will not be retried

${lastError.stack || lastError}

What it means

When downloading template files during `crawlee create`, the CLI retries failed network operations a fixed number of times. If every attempt fails it aggregates the last error's stack into this wrapped Error, prefixed with the operation label, and gives up.

Source

Thrown at packages/cli/src/commands/CreateProjectCommand.ts:62

        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) {
    const promises: Promise<void>[] = [];

    for (const file of template.files) {
        const promise = async () =>
            downloadFile(file.url).then(async (buffer) => {
                // Make sure the folder for the file exists
                const fileDirName = dirname(file.path);
                const fileFolder = resolve(destinationDirectory, fileDirName);
                await mkdir(fileFolder, { recursive: true });

                // Write the actual file

View on GitHub (pinned to dbe57fb09c)

Solutions

  1. Read the inner `lastError.stack` in the message to find the root cause (DNS, HTTP status, etc.).
  2. Fix network/proxy access (set HTTPS_PROXY, allow the template host) and retry the command.
  3. Verify the template name exists (`npx crawlee create --list-templates` or docs).
  4. Retry later if it's rate limiting or a transient outage.

Example fix

# before (fails behind proxy)
npx crawlee create my-app
# after
export HTTPS_PROXY=http://proxy.corp:8080
npx crawlee create my-app
Defensive patterns

Strategy: retry

Validate before calling

await fetch(templateManifestUrl, { method: 'HEAD' }).catch((e) => { console.error('Template host unreachable:', e.message); process.exit(1); });

Try / catch

try { await createProject({ projectName: 'my-app', template: 'ts' }); } catch (err) { console.error(err.message); /* includes lastError.stack with root cause */ process.exitCode = 1; }

Prevention

When it happens

Trigger: Fetching a project template or its manifest from the template repository fails on all retry attempts — network outage, DNS failure, 403/404 on the template URL, proxy blocking, or GitHub rate limiting.

Common situations: Corporate proxies/firewalls blocking registry or GitHub access; offline CI runners; requesting a nonexistent template name; transient network flaps lasting longer than the retry backoff (2500ms + 2500ms per attempt).

Related errors


AI-assisted analysis of apify/crawlee@dbe57fb09c (2026-08-30). Data as JSON: /api/errors/9f579483e057303a. Report an issue: GitHub.