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
- Verify the path exists: `ls` the exact resolved path
- Pass an absolute path or a correct `file://` URL
- Run the command from the project root where the config lives
- 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
- Resolve config paths against an explicit project root, not cwd
- Check file existence before calling loadConfig in dynamic tooling
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
- throw new AssertionError({ message, actual, expected, operat
- expect(received).toThrow() requires a function (got ${typeof
- expected promise to resolve, but it rejected with: ${stringi
- expected promise to reject, but it resolved with: ${stringif
- throw new TypeError(message)
AI-assisted analysis of remix-run/remix@9696913134 (2026-08-27).
Data as JSON: /api/errors/2ecb408b5f390dd2.
Report an issue: GitHub.