{"record":{"id":"b7d463d0400037f0","repo":"facebook/relay","slug":"no-relay-config-found-from-current-directory-pass","errorCode":null,"errorMessage":"No Relay config found from current directory. Pass --config to specify one explicitly.","messagePattern":"No Relay config found from current directory\\. Pass --config to specify one explicitly\\.","errorType":"error_code","errorClass":"CompilerError","httpStatus":null,"severity":"error","filePath":"compiler/crates/relay-bin/src/main.rs","lineNumber":711,"sourceCode":"/// Compiler version string used by the daemon for client/server version checks.\n#[cfg(unix)]\nfn compiler_version() -> String {\n    option_env!(\"CARGO_PKG_VERSION\")\n        .unwrap_or(\"unknown\")\n        .to_string()\n}\n\n#[cfg(unix)]\nasync fn handle_server_command(opt: ServerOpt) -> Result<(), Error> {\n    configure_logger(OutputKind::Verbose, TerminalMode::Mixed);\n\n    // Resolve the config path eagerly — the daemon's socket and log file\n    // paths are derived from it, and `start` and other subcommands must\n    // agree on the hash to talk to the same daemon.\n    let config_path = match opt.config.clone() {\n        Some(p) => p,\n        None => Config::find_path(\n            &current_dir().expect(\"Unable to get current working directory.\"),\n        )\n        .map_err(Error::ConfigError)?\n        .ok_or_else(|| {\n            Error::ConfigError(CompilerError::ConfigError {\n                details: \"No Relay config found from current directory. Pass --config to specify one explicitly.\".to_string(),\n            })\n        })?,\n    };\n\n    match opt.command {\n        ServerCommand::Start {\n            foreground,\n            initial_import_state,\n            initial_changed_files_list,\n        } => {\n            if foreground {\n                start_server_foreground(\n                    &config_path,","sourceCodeStart":693,"sourceCodeEnd":729,"githubUrl":"https://github.com/facebook/relay/blob/668b1b85e06261aa3b58dabfc51f8b5524a70955/compiler/crates/relay-bin/src/main.rs#L693-L729","documentation":"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.","triggerScenarios":"Running `relay server start` (or other server subcommands) from a directory without a relay config file and without passing --config.","commonSituations":"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.","solutions":["Pass --config explicitly: `relay server start --config path/to/relay.config.js`","cd into the directory containing relay.config.js (or a parent of it) before running relay","If the config genuinely does not exist, create relay.config.js in the project root"],"exampleFix":"// before\nrelay server start            // run from repo root, config in packages/app/\n// after\nrelay server start --config packages/app/relay.config.js","handlingStrategy":"validation","validationCode":"const fs = require('fs');\nfunction assertRelayConfig(explicit) {\n  const p = explicit || findUp.sync(['relay.config.js', 'relay.config.json']);\n  if (!p || !fs.existsSync(p)) {\n    throw new Error('No relay config found; pass --config explicitly.');\n  }\n  return p;\n}","typeGuard":null,"tryCatchPattern":"try {\n  await relay(['server', 'start']);\n} catch (e) {\n  if (/No Relay config found/.test(e.message)) {\n    console.error('Run from a directory with relay.config.js or pass --config.');\n  } else throw e;\n}","preventionTips":["Always run relay from the project root containing relay.config.js","Pass --config explicitly in scripts and CI","Keep the config filename exactly relay.config.js","In monorepos, configure per-package working directories"],"tags":["config","cli","relay"],"backgroundTag":"missing-relay-config","analyzedSha":"668b1b85e06261aa3b58dabfc51f8b5524a70955","analyzedAt":"2026-09-02T19:57:20.783Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T02:17:09.455Z"}