remix-run/remix · error · CliError

RMX_CONFIG_NOT_FOUND

RMX_CONFIG_NOT_FOUND

Error message

Could not find Remix configuration file: ${fromPath}

What it means

loadConfig throws this when the path you passed (string or file URL) does not exist on disk (fs.stat fails with ENOENT). It is the entry point for locating the Remix configuration file, so a nonexistent path aborts immediately.

Source

Thrown at packages/cli/src/lib/remix-config.ts:137

  root: JsonNode | undefined
  text: string
}

/**
 * Loads the nearest Remix project configuration or an explicitly selected config file.
 *
 * @param from A config file or directory from which to search upward for `remix.json`. Defaults to
 * `process.cwd()`.
 * @returns The validated Remix project configuration, or an empty object when no config is found.
 */
export async function loadConfig(from: string | URL = process.cwd()): Promise<RemixConfig> {
  let fromPath = path.resolve(from instanceof URL ? fileURLToPath(from) : from)
  let stat

  try {
    stat = await fs.stat(fromPath)
  } catch (error) {
    if (isNodeError(error) && error.code === 'ENOENT') throw remixConfigNotFound(fromPath)
    throw error
  }

  if (stat.isFile()) {
    return loadRemixConfig(path.dirname(fromPath), path.basename(fromPath))
  }

  if (!stat.isDirectory()) {
    throw new TypeError(`Expected a Remix config file or directory: ${fromPath}`)
  }

  let configDir = await findAppRoot(fromPath, 'remix.json')
  return configDir === null ? {} : loadRemixConfig(configDir, undefined)
}

export async function loadRemixConfig(
  cwd: string,
  configPath: string | undefined,

View on GitHub (pinned to 9696913134)

Solutions

  1. Verify the path exists: `ls` the exact resolved path
  2. Pass an absolute path or a correct `file://` URL
  3. Run the command from the project root where the config lives
  4. Create the config file if the project genuinely needs one

Example fix

// before
let config = await loadConfig('./configs/remix.config.ts') // wrong dir
// after
let config = await loadConfig(path.resolve(projectRoot, 'remix.config.ts'))
Defensive patterns

Strategy: validation

Validate before calling

import { stat } from 'node:fs/promises'
const exists = await stat(configPath).then(() => true, () => false)
if (!exists) throw new Error(`Config not found: ${configPath}`)

Type guard

const pathExists = async (p: string): Promise<boolean> =>
  await stat(p).then(() => true, () => false)

Try / catch

catch (error) {
  if (error instanceof Error && error.code === 'RMX_CONFIG_NOT_FOUND') {
    // fall back to defaults or prompt for the config location
  }
  throw error
}

Prevention

When it happens

Trigger: Calling `loadConfig(from)` with a path or `file://` URL that does not exist; wrong relative path resolved against cwd; typo in the config file name.

Common situations: Running the CLI from the wrong working directory so a relative path like `./remix.config.ts` resolves incorrectly; CI checkout missing the config file.

Related errors


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