facebook/relay · error · CompilerError

No Relay config found from current directory. Pass --config

Error message

No Relay config found from current directory. Pass --config to specify one explicitly.

What it means

The relay CLI's `server` subcommand handler must know the config path up front because the daemon's socket and log file paths are hashed from it. When --config is not supplied and Config::find_path finds no relay.config.js in the current directory or its ancestors, it returns Error::ConfigError with this message.

Source

Thrown at compiler/crates/relay-bin/src/main.rs:711

/// Compiler version string used by the daemon for client/server version checks.
#[cfg(unix)]
fn compiler_version() -> String {
    option_env!("CARGO_PKG_VERSION")
        .unwrap_or("unknown")
        .to_string()
}

#[cfg(unix)]
async fn handle_server_command(opt: ServerOpt) -> Result<(), Error> {
    configure_logger(OutputKind::Verbose, TerminalMode::Mixed);

    // Resolve the config path eagerly — the daemon's socket and log file
    // paths are derived from it, and `start` and other subcommands must
    // agree on the hash to talk to the same daemon.
    let config_path = match opt.config.clone() {
        Some(p) => p,
        None => Config::find_path(
            &current_dir().expect("Unable to get current working directory."),
        )
        .map_err(Error::ConfigError)?
        .ok_or_else(|| {
            Error::ConfigError(CompilerError::ConfigError {
                details: "No Relay config found from current directory. Pass --config to specify one explicitly.".to_string(),
            })
        })?,
    };

    match opt.command {
        ServerCommand::Start {
            foreground,
            initial_import_state,
            initial_changed_files_list,
        } => {
            if foreground {
                start_server_foreground(
                    &config_path,

View on GitHub (pinned to 668b1b85e0)

Solutions

  1. Pass --config explicitly: `relay server start --config path/to/relay.config.js`
  2. cd into the directory containing relay.config.js (or a parent of it) before running relay
  3. If the config genuinely does not exist, create relay.config.js in the project root

Example fix

// before
relay server start            // run from repo root, config in packages/app/
// after
relay server start --config packages/app/relay.config.js
Defensive patterns

Strategy: validation

Validate before calling

const fs = require('fs');
function assertRelayConfig(explicit) {
  const p = explicit || findUp.sync(['relay.config.js', 'relay.config.json']);
  if (!p || !fs.existsSync(p)) {
    throw new Error('No relay config found; pass --config explicitly.');
  }
  return p;
}

Try / catch

try {
  await relay(['server', 'start']);
} catch (e) {
  if (/No Relay config found/.test(e.message)) {
    console.error('Run from a directory with relay.config.js or pass --config.');
  } else throw e;
}

Prevention

When it happens

Trigger: Running `relay server start` (or other server subcommands) from a directory without a relay config file and without passing --config.

Common situations: Invoking relay from the repo root when the config lives in a subdirectory (e.g. a monorepo package); typo'd config filename; forgetting --config in CI scripts.

Related errors


AI-assisted analysis of facebook/relay@668b1b85e0 (2026-09-02). Data as JSON: /api/errors/b7d463d0400037f0. Report an issue: GitHub.