{"record":{"id":"0843e5ce80705779","repo":"vercel/next.js","slug":"failed-to-find-the-expected-output-file-outputp","errorCode":null,"errorMessage":"Failed to find the expected output file \"${outputPath}\" generated by the migration tool.","messagePattern":"Failed to find the expected output file \"(.+?)\" generated by the migration tool\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/next-codemod/transforms/next-lint-to-eslint-cli.ts","lineNumber":1111,"sourceCode":"\n    // If legacy config found, run ESLint migration tool first. It will\n    // use FlatCompat, so will continue to migrate using Flat config format.\n    if (existingConfig.isLegacy && existingConfig.path) {\n      console.log(`   Found legacy ESLint config: ${eslintConfigFilename}`)\n\n      // Run npx @eslint/migrate-config\n      const command = `npx @eslint/migrate-config ${existingConfig.path}`\n      console.log(`   Running \"${command}\" to convert legacy config...`)\n      try {\n        execSync(command, {\n          cwd: projectRoot,\n          stdio: 'pipe',\n        })\n\n        // The migration tool creates eslint.config.mjs by default\n        const outputPath = path.join(projectRoot, 'eslint.config.mjs')\n        if (!existsSync(outputPath)) {\n          throw new Error(\n            `Failed to find the expected output file \"${outputPath}\" generated by the migration tool.`\n          )\n        }\n\n        // Use generated config will have FlatCompat, so continue to apply\n        // the next steps to it.\n        eslintConfigPath = outputPath\n        eslintConfigFilename = path.basename(eslintConfigPath)\n      } catch (cause) {\n        throw new Error(\n          `Failed to run \"${command}\" to migrate the legacy ESLint config \"${eslintConfigFilename}\".\\n` +\n            `Please try the migration to Flat config manually.\\n` +\n            `Learn more: https://eslint.org/docs/latest/use/configure/migration-guide`,\n          { cause }\n        )\n      }\n    }\n","sourceCodeStart":1093,"sourceCodeEnd":1129,"githubUrl":"https://github.com/vercel/next.js/blob/0ae8c72462952df163f1b1e0726641bc5b40dc93/packages/next-codemod/transforms/next-lint-to-eslint-cli.ts#L1093-L1129","documentation":"Thrown by the next-lint-to-eslint-cli codemod after it successfully runs `npx @eslint/migrate-config` on a legacy ESLint config but the expected output file `eslint.config.mjs` is not present in the project root. This means the migration tool ran but produced no output or wrote to a different location.","triggerScenarios":"Running `next-codemod` to migrate from legacy ESLint config (.eslintrc.json/.eslintrc.js) to flat config, when the `@eslint/migrate-config` tool completes without error but doesn't create `eslint.config.mjs` in the project root.","commonSituations":"The @eslint/migrate-config version writes a different filename (e.g., eslint.config.js instead of .mjs); the tool silently fails to write output when the input config is empty or malformed; cwd mismatch so the file lands elsewhere; a newer @eslint/migrate-config with changed output behavior.","solutions":["Check the project root for any `eslint.config.*` file the migration tool may have created under a different name.","Run `npx @eslint/migrate-config <your-legacy-config>` manually and inspect its output.","Create the flat config manually following the ESLint migration guide.","Retry the codemod after ensuring the legacy config is valid and non-empty."],"exampleFix":"// The codemod expects eslint.config.mjs after migration.\n// If the tool produced a different name, rename it:\n// mv eslint.config.js eslint.config.mjs\n// Then re-run the codemod.","handlingStrategy":"validation","validationCode":"import { existsSync, readdirSync } from 'fs'\nimport { join } from 'path'\n// After running @eslint/migrate-config, check for any flat config output\nfunction findFlatConfig(projectRoot: string): string | null {\n  const candidates = readdirSync(projectRoot)\n    .filter(f => f.startsWith('eslint.config.'))\n  return candidates.length ? join(projectRoot, candidates[0]) : null\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["After running @eslint/migrate-config, check the output directory for any eslint.config.* file, not just .mjs.","Pin the @eslint/migrate-config version to one known to produce eslint.config.mjs.","Keep a backup of the legacy config so you can migrate manually if the tool's output changes."],"tags":["codemod","eslint","lint","migration"],"analyzedSha":"0ae8c72462952df163f1b1e0726641bc5b40dc93","analyzedAt":"2026-08-06T19:44:29.143Z","schemaVersion":2},"datasetVersion":"2026-08-07T02:17:10.218Z"}