refinedev/refine · error · Error
jscodeshift exited with code ${result.exitCode}
Error message
jscodeshift exited with code ${result.exitCode} What it means
refine's codemod tool wraps jscodeshift via execa.sync; when the jscodeshift child process reports failure (non-zero exit) the wrapper surfaces this error with the actual exit code so you can inspect the transform run.
Source
Thrown at packages/codemod/src/index.ts:111
args.push("--parser=tsx");
args = args.concat(["--transform", transformerPath]);
if (flags.jscodeshift) {
args = args.concat(flags.jscodeshift);
}
args = args.concat(files);
console.log(`Executing command: jscodeshift ${args.join(" ")}`);
const result = execa.sync(jscodeshiftExecutable, args, {
stdio: "inherit",
stripFinalNewline: false,
});
if (result.failed) {
throw new Error(`jscodeshift exited with code ${result.exitCode}`);
}
}
const TRANSFORMER_INQUIRER_CHOICES = [
{
name: "refine4-to-refine5: Transform from refine 4.x.x to at least 5.0.0",
value: "refine4-to-refine5",
},
{
name: "Rename '@refinedev/react-router-v6' imports to '@refinedev/react-router'",
value: "refine-react-router-v6-to-refine-react-router",
},
{
name: "Rename 'react-router-dom' imports to 'react-router'",
value: "react-router-dom-to-react-router",
},
{
name: "Rename deprecated names (queryResult, tableQueryResult, mutationResult) to (query, tableQuery, mutation).",View on GitHub (pinned to 779d52a20e)
Solutions
- Re-run with verbose/dry flags to see jscodeshift's stderr for the failing file
- Exclude or fix the offending file(s), then re-run the codemod
- Ensure the codemod version matches your source/target refine versions (update @refinedev/codemod)
- If a specific transform is broken, perform that migration step manually
Example fix
# before refine codemod refine4-to-refine5 # after npx @refinedev/codemod refine4-to-refine5 --verbose --dry # identify failing files, fix, then re-run
Defensive patterns
Strategy: try-catch
Try / catch
try { runTransform(args); } catch (e) { if (/jscodeshift exited with code/.test(e.message)) { console.error('transform failed — inspect verbose output'); process.exit(1); } throw e; } Prevention
- Run codemods on a clean git tree so failures are revertible
- Use --dry first, and commit before large migrations
When it happens
Trigger: Running `refine codemod` (or the codemod package directly) where the underlying jscodeshift transform fails: syntax errors in source files, a transform crashing on unexpected AST shapes, or bad CLI args.
Common situations: Running refine4-to-refine5 migration on files with unusual syntax, custom Babel/TS plugins, or partially migrated code; version mismatch between codemod and project refine version.
Related errors
- If you use `useDataGrid` hook, you need to use `DataGrid` el
- Invalid provider: ${providerId}
- Timed out while checking for updates.
- ./package.json not found
- Package manager not found.
AI-assisted analysis of refinedev/refine@779d52a20e (2026-08-27).
Data as JSON: /api/errors/f8ea097cb953768c.
Report an issue: GitHub.