vercel/next.js · error

Failed to find the expected output file "${outputPath}" gene

Error message

Failed to find the expected output file "${outputPath}" generated by the migration tool.

What it means

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.

Source

Thrown at packages/next-codemod/transforms/next-lint-to-eslint-cli.ts:1111

    // If legacy config found, run ESLint migration tool first. It will
    // use FlatCompat, so will continue to migrate using Flat config format.
    if (existingConfig.isLegacy && existingConfig.path) {
      console.log(`   Found legacy ESLint config: ${eslintConfigFilename}`)

      // Run npx @eslint/migrate-config
      const command = `npx @eslint/migrate-config ${existingConfig.path}`
      console.log(`   Running "${command}" to convert legacy config...`)
      try {
        execSync(command, {
          cwd: projectRoot,
          stdio: 'pipe',
        })

        // The migration tool creates eslint.config.mjs by default
        const outputPath = path.join(projectRoot, 'eslint.config.mjs')
        if (!existsSync(outputPath)) {
          throw new Error(
            `Failed to find the expected output file "${outputPath}" generated by the migration tool.`
          )
        }

        // Use generated config will have FlatCompat, so continue to apply
        // the next steps to it.
        eslintConfigPath = outputPath
        eslintConfigFilename = path.basename(eslintConfigPath)
      } catch (cause) {
        throw new Error(
          `Failed to run "${command}" to migrate the legacy ESLint config "${eslintConfigFilename}".\n` +
            `Please try the migration to Flat config manually.\n` +
            `Learn more: https://eslint.org/docs/latest/use/configure/migration-guide`,
          { cause }
        )
      }
    }

View on GitHub (pinned to 0ae8c72462)

Solutions

  1. Check the project root for any `eslint.config.*` file the migration tool may have created under a different name.
  2. Run `npx @eslint/migrate-config <your-legacy-config>` manually and inspect its output.
  3. Create the flat config manually following the ESLint migration guide.
  4. Retry the codemod after ensuring the legacy config is valid and non-empty.

Example fix

// The codemod expects eslint.config.mjs after migration.
// If the tool produced a different name, rename it:
// mv eslint.config.js eslint.config.mjs
// Then re-run the codemod.
Defensive patterns

Strategy: validation

Validate before calling

import { existsSync, readdirSync } from 'fs'
import { join } from 'path'
// After running @eslint/migrate-config, check for any flat config output
function findFlatConfig(projectRoot: string): string | null {
  const candidates = readdirSync(projectRoot)
    .filter(f => f.startsWith('eslint.config.'))
  return candidates.length ? join(projectRoot, candidates[0]) : null
}

Prevention

When it happens

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

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

Related errors


AI-assisted analysis of vercel/next.js@0ae8c72462 (2026-08-06). Data as JSON: /api/errors/0843e5ce80705779. Report an issue: GitHub.