facebook/relay · error

A schema in the project root directory is currently not supp

Error message

A schema in the project root directory is currently not supported.

What it means

Validation failure in the compiler config: a project is configured to load its schema from a directory, and that schema directory resolves to the project root itself. Scanning the project root for schema files is unsupported (it would sweep in all source documents), so configuration parsing rejects this layout.

Source

Thrown at compiler/crates/relay-compiler/src/config.rs:1050

    }

    /// Returns all GraphQL schema directories for the config.
    pub fn get_schema_dir_paths(&self) -> Vec<PathBuf> {
        self.projects
            .values()
            .filter_map(|project_config| match &project_config.schema_location {
                SchemaLocation::File(_) | SchemaLocation::CompactFile(_) => None,
                SchemaLocation::Directory(schema_dir) => Some(schema_dir.clone()),
            })
            .collect()
    }

    /// Returns root directories that contain GraphQL schema files.
    pub fn get_schema_file_roots(&self) -> impl Iterator<Item = PathBuf> + use<> {
        self.get_schema_file_paths().into_iter().map(|schema_path| {
            schema_path
                .parent()
                .expect("A schema in the project root directory is currently not supported.")
                .to_owned()
        })
    }
}

fn feature_flags_for_project(
    project_feature_flags: Option<FeatureFlags>,
    global_feature_flags: &FeatureFlags,
    is_multi_project: bool,
) -> FeatureFlags {
    let mut feature_flags = project_feature_flags.unwrap_or_else(|| global_feature_flags.clone());
    if is_multi_project {
        feature_flags.disable_deduping_common_structures_in_raw_response_types =
            global_feature_flags
                .disable_deduping_common_structures_in_raw_response_types
                .clone();
    }
    feature_flags

View on GitHub (pinned to 668b1b85e0)

Solutions

  1. Move schema files into a dedicated subdirectory and point the schema directory config at it
  2. Alternatively use a single schema file (schema.path) or a generated compact schema instead of a directory
  3. Restructure so the project root is not the schema directory
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at compiler/crates/relay-compiler/src/config.rs:1050 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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