mui/material-ui · error · Error

Transform '${transform}' not found. Check out ${path.resolve

Error message

Transform '${transform}' not found. Check out ${path.resolve(__dirname, './README.md for a list of available codemods.')}

What it means

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.

Source

Thrown at packages/mui-codemod/src/codemod.js:41

  let transformerPath;
  let error;
  for (const item of paths) {
    try {
      // eslint-disable-next-line no-await-in-loop
      await fs.stat(item);
      error = undefined;
      transformerPath = item;
      break;
    } catch (srcPathError) {
      error = srcPathError;
      continue;
    }
  }

  if (error) {
    if (error?.code === 'ENOENT') {
      throw new Error(
        `Transform '${transform}' not found. Check out ${path.resolve(
          __dirname,
          './README.md for a list of available codemods.',
        )}`,
      );
    }
    throw error;
  }

  const args = [
    // can't directly spawn `jscodeshiftExecutable` due to https://github.com/facebook/jscodeshift/issues/424
    jscodeshiftExecutable,
    '--transform',
    transformerPath,
    ...codemodFlags,
    '--extensions',
    'js,ts,jsx,tsx,json',
    '--parser',

View on GitHub (pinned to bdc96df2cb)

Solutions

  1. Open the path printed in the error (the codemod package README) and copy the exact transform name, including any `<package>/` prefix.
  2. Run the codemod with no transform argument or with `--help` to list the available transforms for your installed version.
  3. Upgrade the codemod package to the version matching your target MUI major: `npx @mui/codemod@latest` so renamed/new transforms are present.
  4. Confirm you are invoking the binary from the right package (`@mui/codemod`) and not a stale global install.

Example fix

// before
npx @mui/codemod v5-optimized-imports src
// after (exact name + scope)
npx @mui/codemod @mui/material/v5-optimized-imports src
Defensive patterns

Strategy: validation

Validate before calling

// Before spawning the codemod, confirm the transform resolves to one of the four candidate paths.
const fs = require('fs/promises');
const path = require('path');
async function transformExists(codemodRoot, transform) {
  const candidates = [
    path.join(codemodRoot, 'src', transform, 'index.js'),
    path.join(codemodRoot, 'src', `${transform}.js`),
    path.join(codemodRoot, transform, 'index.js'),
    path.join(codemodRoot, `${transform}.js`),
  ];
  for (const c of candidates) {
    try { await fs.stat(c); return true; } catch { /* try next */ }
  }
  return false;
}
if (!(await transformExists(require.resolve('@mui/codemod'), transformName))) {
  throw new Error(`Refusing to run: unknown codemod '${transformName}'`);
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of mui/material-ui@bdc96df2cb (2026-08-12). Data as JSON: /api/errors/cb30d9de70acc311. Report an issue: GitHub.