{"record":{"id":"feae012f0e917efd","repo":"gatsbyjs/gatsby","slug":"you-can-t-create-a-starter-from-the-existing-direc","errorCode":null,"errorMessage":"You can't create a starter from the existing directory. If you want to\n      create a new site in the current directory, the trailing dot isn't\n      necessary. If you want to create a new site from a local starter, run\n      something like \"gatsby new new-gatsby-site ../my-gatsby-starter\"","messagePattern":"You can't create a starter from the existing directory\\. If you want to\n      create a new site in the current directory, the trailing dot isn't\n      necessary\\. If you want to create a new site from a local starter, run\n      something like \"gatsby new new-gatsby-site \\.\\./my-gatsby-starter\"","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/gatsby-cli/src/init-starter.ts","lineNumber":144,"sourceCode":"\nconst ignored = (path: string): boolean =>\n  !/^\\.(git|hg)$/.test(sysPath.basename(path))\n\n// Copy starter from file system.\nconst copy = async (\n  starterPath: string,\n  rootPath: string\n): Promise<boolean> => {\n  // Chmod with 755.\n  // 493 = parseInt('755', 8)\n  await fs.ensureDir(rootPath, { mode: 493 })\n\n  if (!existsSync(starterPath)) {\n    throw new Error(`starter ${starterPath} doesn't exist`)\n  }\n\n  if (starterPath === `.`) {\n    throw new Error(\n      `You can't create a starter from the existing directory. If you want to\n      create a new site in the current directory, the trailing dot isn't\n      necessary. If you want to create a new site from a local starter, run\n      something like \"gatsby new new-gatsby-site ../my-gatsby-starter\"`\n    )\n  }\n\n  report.info(`Creating new site from local starter: ${starterPath}`)\n\n  report.log(`Copying local starter to ${rootPath} ...`)\n\n  await fs.copy(starterPath, rootPath, { filter: ignored })\n\n  report.success(`Created starter directory layout`)\n\n  await install(rootPath)\n\n  return true","sourceCodeStart":126,"sourceCodeEnd":162,"githubUrl":"https://github.com/gatsbyjs/gatsby/blob/8b06340921ffdf23125a365b9c9923690cb62ce6/packages/gatsby-cli/src/init-starter.ts#L126-L162","documentation":"Thrown by init-starter's copy helper when starterPath is exactly '.', blocking the user from cloning the current populated directory onto a new rootPath. It prevents `gatsby new` from recursively copying the cwd (which already contains the project) and producing a confusing nested result.","triggerScenarios":"Invoking `gatsby new my-site .` or otherwise resolving starterPath to '.', then the explicit guard `if (starterPath === '.')` trips before fs.copy runs.","commonSituations":"User runs `gatsby new .` intending to scaffold into the current directory (like `create-react-app .`) — Gatsby interprets '.' as a local starter instead; passing '.' explicitly out of habit from other CLIs.","solutions":["To scaffold a fresh site into the current empty directory, omit the starter arg: `gatsby new my-site` (uses gatsby-starter-default) and point rootPath at cwd.","To copy a real local starter, pass its actual path (e.g. ../my-starter), not '.'.","If you want the current directory's contents as a starter, copy them into a sibling folder first and point gatsby new at that."],"exampleFix":"# before (tries to copy cwd as a starter)\ngatsby new my-site .\n# after (scaffold default starter into ./my-site)\ngatsby new my-site","handlingStrategy":"validation","validationCode":"if (starterPath === '.') {\n  console.error(\"'.' is not a valid starter; to scaffold in cwd omit the starter arg\")\n  process.exit(1)\n}","typeGuard":"const isValidStarterPath = (p: string): boolean => p !== '.'","tryCatchPattern":null,"preventionTips":["Do not pass '.' as a starter.","To scaffold into cwd, omit the starter argument.","Pass an explicit local path or org/repo shorthand."],"tags":["gatsby-cli","init-starter","cli","user-error"],"backgroundTag":null,"analyzedSha":"8b06340921ffdf23125a365b9c9923690cb62ce6","analyzedAt":"2026-08-13T02:36:21.405Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}