{"record":{"id":"b9af3140326a34b5","repo":"yarnpkg/yarn","slug":"name-should-not-start-with-got-str-b9af31","errorCode":null,"errorMessage":"Name should not start with \".\", got \"${str}\"","messagePattern":"Name should not start with \"\\.\", got \"(.+?)\"","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/cli/commands/create.js","lineNumber":26,"sourceCode":"import * as fs from '../../util/fs.js';\nimport {run as runGlobal, getBinFolder} from './global.js';\n\nconst path = require('path');\n\nexport function setFlags(commander: Object) {\n  commander.description('Creates new projects from any create-* starter kits.');\n}\n\nexport function hasWrapper(commander: Object, args: Array<string>): boolean {\n  return true;\n}\n\nexport function parsePackageName(str: string): Object {\n  if (str.charAt(0) === '/') {\n    throw new Error(`Name should not start with \"/\", got \"${str}\"`);\n  }\n  if (str.charAt(0) === '.') {\n    throw new Error(`Name should not start with \".\", got \"${str}\"`);\n  }\n  const parts = str.split('/');\n  const isScoped = str.charAt(0) === '@';\n  if (isScoped && parts[0] === '@') {\n    throw new Error(`Scope should not be empty, got \"${str}\"`);\n  }\n  const scope = isScoped ? parts[0] : '';\n  const name = parts[isScoped ? 1 : 0] || '';\n  const path = parts.slice(isScoped ? 2 : 1).join('/');\n  const fullName = [scope, name].filter(Boolean).join('/');\n  const full = [scope, name, path].filter(Boolean).join('/');\n\n  return {fullName, name, scope, path, full};\n}\n\nexport function coerceCreatePackageName(str: string): Object {\n  const pkgNameObj = parsePackageName(str);\n  const coercedName = pkgNameObj.name !== '' ? `create-${pkgNameObj.name}` : `create`;","sourceCodeStart":8,"sourceCodeEnd":44,"githubUrl":"https://github.com/yarnpkg/yarn/blob/c2dda503f3759b5be5f0e24ecd9cf5c97a540147/src/cli/commands/create.js#L8-L44","documentation":"Same `parsePackageName` validator; at `create.js:26` it rejects a leading `.` because relative-path package names are not valid npm package identifiers. The check fires before scope/name splitting.","triggerScenarios":"`str.charAt(0) === '.'` — argument like `yarn create ./react-app` or `yarn create .foo`.","commonSituations":"Passing a relative path instead of a kit name, or a stray dot from a typo / shell history substitution.","solutions":["Drop the leading dot: `yarn create react-app`.","For a local starter, invoke the kit's binary directly instead of via `yarn create`."],"exampleFix":"// before\n$ yarn create ./starter my-app\n\n// after\n$ yarn create starter my-app","handlingStrategy":"validation","validationCode":"function assertNoLeadingDot(str: string): void {\n  if (str.charAt(0) === '.') {\n    throw new Error(`Package name must not start with '.': got '${str}'`);\n  }\n}","typeGuard":"function hasNoLeadingDot(s: string): boolean {\n  return s.length > 0 && s.charAt(0) !== '.';\n}","tryCatchPattern":null,"preventionTips":["Distinguish kit names from file paths in CLI wrappers and reject relative-path inputs."],"tags":["yarn-create","validation","package-name"],"backgroundTag":null,"analyzedSha":"c2dda503f3759b5be5f0e24ecd9cf5c97a540147","analyzedAt":"2026-08-13T04:17:06.305Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}