{"record":{"id":"83c3aa9432d9818b","repo":"facebook/relay","slug":"failed-to-read-glob-entry","errorCode":null,"errorMessage":"Failed to read glob entry: {}","messagePattern":"Failed to read glob entry: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"compiler/crates/graphql-ir-diff/src/lib.rs","lineNumber":808,"sourceCode":"    )\n    .map_err(|diagnostics| anyhow::anyhow!(diagnostics.iter().join(\"\\n\")))?;\n\n    Ok(Program::from_definitions(schema, ir))\n}\n\npub fn load_schema(schema_paths: Vec<String>) -> Result<Arc<SDLSchema>> {\n    // Collect (content, file_path) pairs for each schema file\n    let schema_files: Vec<(String, String)> = schema_paths\n        .clone()\n        .into_iter()\n        .map(|pattern| {\n            // expand if path contains \"*\"\n            let paths = glob::glob(&pattern)\n                .map_err(|e| anyhow!(\"Invalid glob pattern '{}': {}\", pattern, e))?;\n            let file_entries: Result<Vec<(String, String)>> = paths\n                .map(|entry| {\n                    let file_path =\n                        entry.map_err(|e| anyhow!(\"Failed to read glob entry: {}\", e))?;\n                    let file_path_str = file_path.to_string_lossy().to_string();\n                    let schema_bytes = fs::read(file_path)?;\n                    let content = String::from_utf8(schema_bytes)\n                        .map_err(|e| anyhow!(\"Cannot parse schema utf8 from bytes: {}\", e))?;\n                    Ok((content, file_path_str))\n                })\n                .collect();\n            file_entries\n        })\n        .collect::<Result<Vec<_>>>()?\n        .into_iter()\n        .flatten()\n        .collect();\n\n    if schema_files.is_empty() {\n        return Err(anyhow!(\n            \"No schema loaded for paths: {}\",\n            schema_paths.join(\",\")","sourceCodeStart":790,"sourceCodeEnd":826,"githubUrl":"https://github.com/facebook/relay/blob/668b1b85e06261aa3b58dabfc51f8b5524a70955/compiler/crates/graphql-ir-diff/src/lib.rs#L790-L826","documentation":"During load_schema, each path yielded by a glob is opened; if a matched entry cannot be turned into a path or opened while walking (e.g. IO error on the entry itself), the error is wrapped as 'Failed to read glob entry'. The pattern was valid, but reading one of its results failed.","triggerScenarios":"Calling load_schema/compare with a valid glob where a matched entry is unreadable: file deleted between glob and read, permission denied, entry is a broken symlink, or the glob recursed into a directory with restricted access.","commonSituations":"Races with other processes cleaning temp files; sandboxed CI runners lacking read permission on a directory; broken symlinks in a schemas directory; reading across mount points that disappeared.","solutions":["Check the underlying IO error in the message and fix permissions or restore the missing entry.","Remove or repair broken symlinks matched by the glob.","Narrow the glob pattern so it only matches real schema files (e.g. '**/*.graphql') instead of broad '**'.","Re-run the load; if it is a transient race, retry after the external process finishes."],"exampleFix":"// before\nload_schema(vec![\"schemas/**\".to_string()])?; // matches broken symlink\n// after\nload_schema(vec![\"schemas/**/*.graphql\".to_string()])?;","handlingStrategy":"retry","validationCode":"fn readable(path: &std::path::Path) -> bool {\n    std::fs::metadata(path).map(|m| m.is_file()).unwrap_or(false)\n}\n// filter glob matches before loading\nlet paths: Vec<String> = paths.into_iter().filter(|p| readable(std::path::Path::new(p))).collect();","typeGuard":null,"tryCatchPattern":"match load_schema(patterns) {\n    Ok(schema) => schema,\n    Err(e) if e.to_string().contains(\"Failed to read glob entry\") => {\n        std::thread::sleep(Duration::from_millis(200));\n        load_schema(patterns)? // one retry for transient races\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Tighten globs to real schema extensions to skip symlinks/dirs.","Avoid racing cleanup jobs over schema directories in CI.","Check filesystem permissions for the schemas directory."],"tags":["glob","io","filesystem","permissions"],"backgroundTag":"file-read-failed","analyzedSha":"668b1b85e06261aa3b58dabfc51f8b5524a70955","analyzedAt":"2026-09-02T19:57:20.783Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T02:17:09.455Z"}