{"record":{"id":"bba486661309edfc","repo":"withastro/astro","slug":"template-tmpl-does-not-exist","errorCode":null,"errorMessage":"Template ${tmpl} does not exist!","messagePattern":"Template (.+?) does not exist!","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/create-astro/src/actions/template.ts","lineNumber":193,"sourceCode":"\t\t\tconst readmePath = path.resolve(ctx.cwd, 'README.md');\n\t\t\tif (fs.existsSync(readmePath)) {\n\t\t\t\tconst readme = fs.readFileSync(readmePath, 'utf8');\n\t\t\t\tconst processedReadme = processTemplateReadme(readme, ctx.packageManager);\n\t\t\t\tfs.writeFileSync(readmePath, processedReadme);\n\t\t\t}\n\t\t} catch (err: any) {\n\t\t\t// Only remove the directory if it's most likely created by us.\n\t\t\tif (ctx.cwd !== '.' && ctx.cwd !== './' && !ctx.cwd.startsWith('../')) {\n\t\t\t\ttry {\n\t\t\t\t\tfs.rmdirSync(ctx.cwd);\n\t\t\t\t} catch (_) {\n\t\t\t\t\t// Ignore any errors from removing the directory,\n\t\t\t\t\t// make sure we throw and display the original error.\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (err.message?.includes('404')) {\n\t\t\t\tthrow new Error(`Template ${color.reset(tmpl)} ${color.dim('does not exist!')}`);\n\t\t\t}\n\n\t\t\tif (err.message) {\n\t\t\t\terror('error', err.message);\n\t\t\t}\n\t\t\ttry {\n\t\t\t\t// The underlying error is often buried deep in the `cause` property\n\t\t\t\t// This is in a try/catch block in case of weirdnesses in accessing the `cause` property\n\t\t\t\tif ('cause' in err) {\n\t\t\t\t\t// This is probably included in err.message, but we can log it just in case it has extra info\n\t\t\t\t\terror('error', err.cause);\n\t\t\t\t\tif ('cause' in err.cause) {\n\t\t\t\t\t\t// Hopefully the actual fetch error message\n\t\t\t\t\t\terror('error', err.cause?.cause);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} catch {}\n\t\t\tthrow new Error(`Unable to download template ${color.reset(tmpl)}`);","sourceCodeStart":175,"sourceCodeEnd":211,"githubUrl":"https://github.com/withastro/astro/blob/d081033d5fe8e8a68c4bbbad4af9d2deb9c74bca/packages/create-astro/src/actions/template.ts#L175-L211","documentation":"Thrown by `create-astro` when fetching a starter template and the download request returns a 404. The template name does not resolve to a known template in the registry. The error is detected by string-matching '404' in the caught error message and re-thrown with a friendly, colorized message.","triggerScenarios":"Running `npm create astro@latest -- --template <name>` where `<name>` is misspelled, deprecated, or not in the official template list. The fetch to the template archive returns HTTP 404.","commonSituations":"Typos in template name (e.g. 'blogg' instead of 'blog'). Using a template name from an outdated docs version. Referencing a template that was renamed or removed from the astro repo.","solutions":["Run `npm create astro@latest` without `--template` and pick from the interactive list to see valid names.","Check the official templates at https://github.com/withastro/astro/tree/main/examples for exact folder names.","Supply a full git URL or local path instead of a template name if you need a custom template."],"exampleFix":"# before\nnpm create astro@latest -- --template blogg\n\n# after\nnpm create astro@latest -- --template blog","handlingStrategy":"validation","validationCode":"const VALID_TEMPLATES = ['minimal','basics','blog','portfolio','starlight','...'];\nif (!VALID_TEMPLATES.includes(requestedTemplate)) {\n  console.warn(`Unknown template '${requestedTemplate}'. Valid: ${VALID_TEMPLATES.join(', ')}`);\n}","typeGuard":null,"tryCatchPattern":"try {\n  await createProject({ template });\n} catch (e) {\n  if (/does not exist/.test(e.message)) { /* prompt user to pick from list */ }\n  else throw e;\n}","preventionTips":["Run `npm create astro@latest` interactively to see the current valid template list.","Cross-check template names against the examples/ directory in the astro repo.","Use exact lowercase folder names from the examples directory."],"tags":["create-astro","cli","template","network"],"backgroundTag":null,"analyzedSha":"d081033d5fe8e8a68c4bbbad4af9d2deb9c74bca","analyzedAt":"2026-08-12T13:37:29.035Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}