{"record":{"id":"cb30d9de70acc311","repo":"mui/material-ui","slug":"transform-transform-not-found-check-out-pa","errorCode":null,"errorMessage":"Transform '${transform}' not found. Check out ${path.resolve(__dirname, './README.md for a list of available codemods.')}","messagePattern":"Transform '(.+?)' not found\\. Check out (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/mui-codemod/src/codemod.js","lineNumber":41,"sourceCode":"\n  let transformerPath;\n  let error;\n  for (const item of paths) {\n    try {\n      // eslint-disable-next-line no-await-in-loop\n      await fs.stat(item);\n      error = undefined;\n      transformerPath = item;\n      break;\n    } catch (srcPathError) {\n      error = srcPathError;\n      continue;\n    }\n  }\n\n  if (error) {\n    if (error?.code === 'ENOENT') {\n      throw new Error(\n        `Transform '${transform}' not found. Check out ${path.resolve(\n          __dirname,\n          './README.md for a list of available codemods.',\n        )}`,\n      );\n    }\n    throw error;\n  }\n\n  const args = [\n    // can't directly spawn `jscodeshiftExecutable` due to https://github.com/facebook/jscodeshift/issues/424\n    jscodeshiftExecutable,\n    '--transform',\n    transformerPath,\n    ...codemodFlags,\n    '--extensions',\n    'js,ts,jsx,tsx,json',\n    '--parser',","sourceCodeStart":23,"sourceCodeEnd":59,"githubUrl":"https://github.com/mui/material-ui/blob/bdc96df2cb530fcdd60a7a7aabe37f610ce0f0a5/packages/mui-codemod/src/codemod.js#L23-L59","documentation":"Thrown by the MUI codemod CLI when the transform name passed on the command line does not resolve to any file. The runner probes four candidate paths (./src/<transform>/index.js, ./src/<transform>.js, ./<transform>/index.js, ./<transform>.js relative to the codemod package) and, if every stat() fails with ENOENT, aborts with this message pointing at the README. It exists so typos in the transform name fail loudly instead of jscodeshift silently doing nothing.","triggerScenarios":"Running `npx @mui/codemod <packageName>/<transform> <path>` (or the `mui-codemod` alias) where <transform> is misspelled, uses wrong casing, targets a transform that was renamed/removed in the installed codemod version, or omits the package prefix the runner expects.","commonSituations":"Upgrading MUI and copying a codemod name from outdated docs; running a v5->v6 migration with a v4-era codemod package installed; typo like `opti-imports` instead of `optimized-imports`; using a transform scoped to a package you are not migrating.","solutions":["Open the path printed in the error (the codemod package README) and copy the exact transform name, including any `<package>/` prefix.","Run the codemod with no transform argument or with `--help` to list the available transforms for your installed version.","Upgrade the codemod package to the version matching your target MUI major: `npx @mui/codemod@latest` so renamed/new transforms are present.","Confirm you are invoking the binary from the right package (`@mui/codemod`) and not a stale global install."],"exampleFix":"// before\nnpx @mui/codemod v5-optimized-imports src\n// after (exact name + scope)\nnpx @mui/codemod @mui/material/v5-optimized-imports src","handlingStrategy":"validation","validationCode":"// Before spawning the codemod, confirm the transform resolves to one of the four candidate paths.\nconst fs = require('fs/promises');\nconst path = require('path');\nasync function transformExists(codemodRoot, transform) {\n  const candidates = [\n    path.join(codemodRoot, 'src', transform, 'index.js'),\n    path.join(codemodRoot, 'src', `${transform}.js`),\n    path.join(codemodRoot, transform, 'index.js'),\n    path.join(codemodRoot, `${transform}.js`),\n  ];\n  for (const c of candidates) {\n    try { await fs.stat(c); return true; } catch { /* try next */ }\n  }\n  return false;\n}\nif (!(await transformExists(require.resolve('@mui/codemod'), transformName))) {\n  throw new Error(`Refusing to run: unknown codemod '${transformName}'`);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pin the codemod package version to the major you are migrating to so transform names match the docs.","Copy transform names directly from the codemod README rather than retyping them.","In CI wrappers, validate the transform exists before invoking the CLI."],"tags":["codemod","cli","migration","configuration"],"backgroundTag":null,"analyzedSha":"bdc96df2cb530fcdd60a7a7aabe37f610ce0f0a5","analyzedAt":"2026-08-12T22:59:56.717Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}