gatsbyjs/gatsby · error

You have not provided a directory name for your site. Please

Error message

You have not provided a directory name for your site. Please do so when running with the 'y' flag.

What it means

Validation-helper warning from create-gatsby's project name validator (used as the inquirer `valid` function): the answer was empty/falsy, which typically happens when running `create-gatsby -y` (defaults mode) without passing a directory name argument. Validation fails so the prompt (or process) rejects the value.

Source

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

  mustSelect = false
): Array<{ message: string; name: string; disabled?: boolean }> => {
  const entries = Object.entries(options).map(([name, message]) => {
    return { name, message: message.message }
  })

  if (mustSelect) {
    return entries
  }

  const none = { name: `none`, message: `No (or I'll add it later)` }
  const divider = { name: `–`, role: `separator`, message: `–` }

  return [none, divider, ...entries]
}

export function validateProjectName(value: string): boolean {
  if (!value) {
    reporter.warn(
      `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))) {

View on GitHub (pinned to e85d62f177)

Solutions

  1. Pass the site directory name as an argument, e.g. `npm init gatsby@latest my-site -y`
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/create-gatsby/src/utils/question-helpers.ts:35 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/2533552e1a6a26fb. Report an issue: GitHub.