remix-run/remix · error · Error

Doctor fix path resolves outside the app root: ${fixPath}

Error message

Doctor fix path resolves outside the app root: ${fixPath}

What it means

Doctor applies automated fixes only to files inside the app root; this error fires when a fix path, after resolution, lands outside that root. It is a safety guard for the `remix doctor` repair steps.

Source

Thrown at packages/cli/src/lib/doctor/fixes.ts:132

    if (isErrorWithCode(error, 'ENOENT')) {
      return null
    }

    throw error
  }
}

function isPathInsideRoot(rootPath: string, filePath: string): boolean {
  let relativePath = path.relative(rootPath, filePath)
  return relativePath === '' || (!relativePath.startsWith('..') && !path.isAbsolute(relativePath))
}

function isErrorWithCode(error: unknown, code: string): boolean {
  return typeof error === 'object' && error !== null && 'code' in error && error.code === code
}

function throwDoctorFixPathOutsideRoot(fixPath: string): never {
  throw new Error(`Doctor fix path resolves outside the app root: ${fixPath}`)
}

View on GitHub (pinned to 9696913134)

Solutions

  1. Re-run `remix doctor` from the actual app root directory (where remix.json lives)
  2. Verify remix.json exists in the expected package so app-root detection succeeds
  3. If the fix legitimately targets a shared file, move or configure the app root to include it

Example fix

# before
packages/app/subdir $ remix doctor --fix
# after
packages/app $ remix doctor --fix
Defensive patterns

Strategy: validation

Validate before calling

let resolved = path.resolve(appRoot, fixPath)
if (!resolved.startsWith(path.resolve(appRoot) + path.sep)) {
  // re-run doctor from the correct app root instead
}

Prevention

When it happens

Trigger: resolveDoctorFixPath encountering a fixPath (from a doctor fix definition or resolved relative to the app) that normalizes to a location outside the app root directory.

Common situations: Running `remix doctor --fix` in a monorepo where the detected app root is wrong (run from package subdirectory), or a fix target computed via '../../' style paths; stale or moved project layout.

Related errors


AI-assisted analysis of remix-run/remix@9696913134 (2026-08-27). Data as JSON: /api/errors/268d96ec1dae8034. Report an issue: GitHub.