{"record":{"id":"1e4f9f7df26ba162","repo":"withastro/astro","slug":"template-color-reset-tmpl-color-dim-does-no","errorCode":null,"errorMessage":"Template ${color.reset(tmpl)} ${color.dim('does not exist!')}","messagePattern":"Template (.+?) (.+?)","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/52e6c34790cc8ac4e69e6135ace06049867e5c4a/packages/create-astro/src/actions/template.ts#L175-L211","documentation":"create-astro resolves your --template argument to a giget download target: built-in names map to github:withastro/astro#examples/<name>, starlight[/starter] maps to Starlight's examples, and anything containing a slash (owner/repo) is treated as a third-party template. When the download returns a 404, the failure is rethrown as 'Template ... does not exist!'. The given name matches no example directory or repository at the resolved ref.","triggerScenarios":"A misspelled built-in name (--template basic instead of basics); a starlight starter that does not exist (starlight/none); a third-party owner/repo where the repo or its default branch does not exist; a --ref pointing at a branch/tag that lacks that examples directory.","commonSituations":"Typos in template names; using --ref from before an example was renamed or removed; private or nonexistent GitHub repositories.","solutions":["Use a known template name (basics, blog, minimal, ...) or run npm create astro without --template to choose interactively","For third-party templates, double-check owner/repo spelling and that the repository is public","If you passed --ref, verify that branch or tag actually contains the template directory"],"exampleFix":"# before\nnpm create astro@latest -- --template basic\n\n# after\nnpm create astro@latest -- --template basics","handlingStrategy":"validation","validationCode":"// verify a built-in template name exists before scaffolding\nconst res = await fetch('https://api.github.com/repos/withastro/astro/contents/examples?ref=main');\nconst entries = await res.json();\nconst names = entries.map((e) => e.name.replace(/\\.tgz$/, ''));\nif (!names.includes(tmpl)) {\n\tconsole.error(`Unknown template '${tmpl}'. Available: ${names.join(', ')}`);\n\tprocess.exit(1);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run npm create astro without --template first and pick from the interactive list to learn valid names","For third-party templates, confirm the owner/repo exists and is public before scripting it","Pin a --ref that is known to contain the examples directory when automating scaffolding"],"tags":["create-astro","cli","template","scaffolding"],"backgroundTag":"template-not-found","analyzedSha":"52e6c34790cc8ac4e69e6135ace06049867e5c4a","analyzedAt":"2026-08-18T18:48:03.901Z","contentChangedAt":"2026-08-18T18:48:03.901Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}