gatsbyjs/gatsby · error

The destination "${value}" already exists. Please choose a d

Error message

The destination "${value}" already exists. Please choose a different name

What it means

Validation-helper warning from create-gatsby's project name validator: fs.existsSync resolved the supplied name to an already-existing directory, so scaffolding a new site there would overwrite it. The validator returns false to force a different name.

Source

Thrown at packages/create-gatsby/src/utils/question-helpers.ts:54

      `You have not provided a directory name for your site. Please do so when running with the 'y' flag.`
    )
    return false
  }
  value = value.trim()
  if (INVALID_FILENAMES.test(value)) {
    reporter.warn(
      `The destination "${value}" is not a valid filename. Please try again, avoiding special characters.`
    )
    return false
  }
  if (process.platform === `win32` && INVALID_WINDOWS.test(value)) {
    reporter.warn(
      `The destination "${value}" is not a valid Windows filename. Please try another name`
    )
    return false
  }
  if (fs.existsSync(path.resolve(value))) {
    reporter.warn(
      `The destination "${value}" already exists. Please choose a different name`
    )
    return false
  }
  return true
}

// Enquirer types are not exported and are out of date
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export const generateQuestions = (
  initialFolderName: string,
  flags: IFlags
): any => {
  const siteNameQuestion = {
    type: `textinput`,
    name: `project`,
    message: `What would you like to name the folder where your site will be created?`,
    hint: path.basename(process.cwd()),

View on GitHub (pinned to e85d62f177)

Solutions

  1. Choose a different site name
  2. Or delete/move the existing directory first
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/create-gatsby/src/utils/question-helpers.ts:54 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of gatsbyjs/gatsby@e85d62f177 (2026-08-26). Data as JSON: /api/errors/93496078ca01fd9e. Report an issue: GitHub.