{"record":{"id":"ad647b0d760a836c","repo":"facebook/docusaurus","slug":"no-files-to-copy-from-path-frompath-with-glob-c","errorCode":null,"errorMessage":"No files to copy from path=${fromPath} with glob code=${globPatternPosix}","messagePattern":"No files to copy from path=(.+?) with glob code=(.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/docusaurus/src/commands/swizzle/actions.ts","lineNumber":82,"sourceCode":"  const filesToCopy = await Globby(globPatternPosix, {\n    // Workaround for Tinyglobby bug?\n    // We glob absolute from the theme root path, not from cwd\n    // See https://github.com/SuperchupuDev/tinyglobby/issues/186\n    cwd: themePath,\n    absolute: true,\n\n    ignore: _.compact([\n      '**/*.{story,stories,test,tests}.{js,jsx,ts,tsx}',\n      // When ejecting JS components, we want to avoid emitting TS files\n      // In particular the .d.ts files that theme build output contains\n      typescript ? null : '**/*.{d.ts,ts,tsx}',\n      '**/{__fixtures__,__tests__}/*',\n    ]),\n  });\n\n  if (filesToCopy.length === 0) {\n    // This should never happen\n    throw new Error(\n      logger.interpolate`No files to copy from path=${fromPath} with glob code=${globPatternPosix}`,\n    );\n  }\n\n  const toPath = path.join(siteDir, THEME_PATH);\n\n  await fs.ensureDir(toPath);\n\n  const createdFiles = await Promise.all(\n    filesToCopy.map(async (sourceFile: string) => {\n      const targetFile = path.join(\n        toPath,\n        path.relative(themePath, sourceFile),\n      );\n      try {\n        const fileContents = await fs.readFile(sourceFile, 'utf-8');\n        await fs.outputFile(\n          targetFile,","sourceCodeStart":64,"sourceCodeEnd":100,"githubUrl":"https://github.com/facebook/docusaurus/blob/3f483e80e326cc646b54b83d564b3f0c4881b9a6/packages/docusaurus/src/commands/swizzle/actions.ts#L64-L100","documentation":"Thrown inside `eject()` (the swizzle eject action) when Globby returns zero files for the resolved component path/glob. The code itself flags this as 'should never happen' — it indicates the resolved theme path did not contain the expected source files after applying the ignore rules.","triggerScenarios":"Running `docusaurus swizzle <theme> <component> --eject` where the computed `fromPath` plus the JS/TS-aware ignore patterns produces no matches. Triggered when the theme package is corrupt, the component path resolves to nothing, or the `--typescript`/JS filter excludes every file.","commonSituations":"Corrupted or partial theme package install (missing files); passing `--javascript` against a TS-only component whose compiled JS was stripped; pnpm hoisting placing the theme path elsewhere; mismatched theme version where a component was removed.","solutions":["Reinstall node_modules: `rm -rf node_modules && pnpm install` (or npm/yarn equivalent) to restore missing theme files.","Retry without the language flag (e.g. drop `--javascript`) so the ignore filters do not strip all files.","Confirm the component name is valid: run `docusaurus swizzle <theme> --list` and copy the exact name.","Check the resolved theme path actually contains the file: `ls <themePath>/<component>` and inspect what Globby would match."],"exampleFix":"# before\ndocusaurus swizzle @docusaurus/theme-classic NotFound --eject --javascript  # 0 files\n# after\nrm -rf node_modules && pnpm install\ndocusaurus swizzle @docusaurus/theme-classic NotFound --eject","handlingStrategy":"validation","validationCode":"import {Globby, posixPath} from '@docusaurus/utils';\nconst files = await Globby(posixPath(globPattern), {cwd: themePath, absolute: true});\nif (files.length === 0) throw new Error('Theme path empty — reinstall the theme package');","typeGuard":null,"tryCatchPattern":"try { await eject({siteDir, themePath, componentName, typescript}); }\ncatch (e) {\n  if (/No files to copy/.test(e.message)) {\n    console.error('Reinstall node_modules and retry without language flags'); process.exit(1);\n  }\n  throw e;\n}","preventionTips":["Pin theme versions in package.json to avoid partial installs.","Run `docusaurus swizzle <theme> --list` before ejecting to confirm the component exists.","Keep node_modules clean in CI (use lockfile, avoid hoisting quirks)."],"tags":["swizzle","eject","theme","filesystem"],"backgroundTag":null,"analyzedSha":"3f483e80e326cc646b54b83d564b3f0c4881b9a6","analyzedAt":"2026-08-12T13:25:04.382Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}