{"record":{"id":"f8ea097cb953768c","repo":"refinedev/refine","slug":"jscodeshift-exited-with-code-result-exitcode","errorCode":null,"errorMessage":"jscodeshift exited with code ${result.exitCode}","messagePattern":"jscodeshift exited with code (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/codemod/src/index.ts","lineNumber":111,"sourceCode":"  args.push(\"--parser=tsx\");\n\n  args = args.concat([\"--transform\", transformerPath]);\n\n  if (flags.jscodeshift) {\n    args = args.concat(flags.jscodeshift);\n  }\n\n  args = args.concat(files);\n\n  console.log(`Executing command: jscodeshift ${args.join(\" \")}`);\n\n  const result = execa.sync(jscodeshiftExecutable, args, {\n    stdio: \"inherit\",\n    stripFinalNewline: false,\n  });\n\n  if (result.failed) {\n    throw new Error(`jscodeshift exited with code ${result.exitCode}`);\n  }\n}\n\nconst TRANSFORMER_INQUIRER_CHOICES = [\n  {\n    name: \"refine4-to-refine5: Transform from refine 4.x.x to at least 5.0.0\",\n    value: \"refine4-to-refine5\",\n  },\n  {\n    name: \"Rename '@refinedev/react-router-v6' imports to '@refinedev/react-router'\",\n    value: \"refine-react-router-v6-to-refine-react-router\",\n  },\n  {\n    name: \"Rename 'react-router-dom' imports to 'react-router'\",\n    value: \"react-router-dom-to-react-router\",\n  },\n  {\n    name: \"Rename deprecated names (queryResult, tableQueryResult, mutationResult) to (query, tableQuery, mutation).\",","sourceCodeStart":93,"sourceCodeEnd":129,"githubUrl":"https://github.com/refinedev/refine/blob/779d52a20e29b0307ac0df04d135beba434370dc/packages/codemod/src/index.ts#L93-L129","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"# before\nrefine codemod refine4-to-refine5\n# after\nnpx @refinedev/codemod refine4-to-refine5 --verbose --dry  # identify failing files, fix, then re-run","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"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; }","preventionTips":["Run codemods on a clean git tree so failures are revertible","Use --dry first, and commit before large migrations"],"tags":["codemod","jscodeshift","migration","cli"],"backgroundTag":"codemod-transform-failed","analyzedSha":"779d52a20e29b0307ac0df04d135beba434370dc","analyzedAt":"2026-08-27T11:15:25.854Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}