vercel/next.js · error · Error

Failed to resolve pattern

Error message

Failed to resolve pattern "${patterns.join(',')}": ${isError(error) ? error.message : String(error)}

What it means

Error boundary around glob resolution in resolveBuildPaths: expanding the combined include pattern (with excludes) against projectDir threw — glob syntax errors or filesystem access problems are the usual causes. The original error message is embedded so the failing pattern and cause stay visible.

Solutions

  1. Fix the glob patterns so they resolve to existing paths; check for typos in the configured build paths.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: A configured build path glob pattern fails to resolve.

Common situations: An invalid glob in resolve-build-paths configuration or plugin paths.


AI-assisted analysis of vercel/next.js@0eb3775416 (2026-08-19). Data as JSON: /api/errors/80a8981257e9c717. Report an issue: GitHub.

Appendix: source

Thrown at packages/next/src/lib/resolve-build-paths.ts:100

      : `{${includePatterns.join(',')}}`

  try {
    const matches = (await glob(combinedPattern, {
      cwd: projectDir,
      ignore: excludePatterns,
    })) as string[]

    if (matches.length === 0) {
      Log.warn(`Pattern "${patterns.join(',')}" did not match any files`)
    }

    for (const file of matches) {
      if (!fs.statSync(path.join(projectDir, file)).isDirectory()) {
        categorizeAndAddPath(file, appPaths, pagePaths, validFileMatcher)
      }
    }
  } catch (error) {
    throw new Error(
      `Failed to resolve pattern "${patterns.join(',')}": ${
        isError(error) ? error.message : String(error)
      }`
    )
  }

  return {
    appPaths: Array.from(appPaths).sort(),
    pagePaths: Array.from(pagePaths).sort(),
  }
}

/**
 * When the project keeps its `app/` or `pages/` directory under `src/`, prepend
 * `src/` to bare patterns so the glob actually matches files on disk. Patterns
 * that already include the `src/` prefix are returned unchanged.
 */
function addSrcPrefixIfNeeded(

View on GitHub (pinned to 0eb3775416)