{"record":{"id":"a3b21c28f5ca138b","repo":"emilk/egui","slug":"failed-to-read","errorCode":null,"errorMessage":"Failed to read {}: {}","messagePattern":"Failed to read (.+?): (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/egui_kittest/src/config.rs","lineNumber":127,"sourceCode":"                \"`{prefix}failed_pixel_count_threshold` in kittest.toml is deprecated; \\\n                 use `{prefix}max_failed_pixels` instead.\"\n            );\n        }\n    }\n}\n\nfn load_config() -> Config {\n    if let Ok(config_path) = find_kittest_toml() {\n        match std::fs::read_to_string(&config_path) {\n            Ok(config_str) => {\n                warn_about_deprecated_keys(&config_str);\n                match toml::from_str(&config_str) {\n                    Ok(config) => config,\n                    Err(err) => panic!(\"Failed to parse {}: {err}\", config_path.display()),\n                }\n            }\n            Err(err) => {\n                panic!(\"Failed to read {}: {}\", config_path.display(), err);\n            }\n        }\n    } else {\n        Config::default()\n    }\n}\n\n/// Get the global configuration.\n///\n/// See [`Config::global`] for details.\npub fn config() -> &'static Config {\n    Config::global()\n}\n\nimpl Config {\n    /// Get or load the global configuration.\n    ///\n    /// This is either","sourceCodeStart":109,"sourceCodeEnd":145,"githubUrl":"https://github.com/emilk/egui/blob/441971a776322a482e371775219380eca812cfa9/crates/egui_kittest/src/config.rs#L109-L145","documentation":"This panic occurs in HarnessBuilder::load_config when the kittest config file (kittest.toml) exists but cannot be read from disk. The library wraps the std::fs::read_to_string result and panics on any I/O error rather than falling back to defaults, because a config that exists but is unreadable signals an environment problem the user must fix. It is distinct from a parse failure (which produces 'Failed to parse ...').","triggerScenarios":"Calling the harness builder when a kittest config file exists at the resolved config path but fs::read_to_string returns Err — e.g. missing read permissions, the path is a directory, or the file is deleted between existence check and read.","commonSituations":"CI containers running tests as a non-root user without file permissions; a kittest.toml checked in with restrictive modes; kittest.toml accidentally replaced by a directory or symlink to an inaccessible file; disk/permission issues in sandboxed environments.","solutions":["Check file permissions on the config file and fix them (chmod/chown) so the test user can read it","Verify the config path is a regular file, not a directory or broken symlink","Remove or rename the config file if you intended to use defaults instead","Re-run the test to confirm the I/O error is gone"],"exampleFix":"// before (shell)\n$ ls -l kittest.toml\n-rw------- 1 root root kittest.toml\n// after\n$ sudo chmod 644 kittest.toml","handlingStrategy":"validation","validationCode":"let path = std::path::Path::new(\"kittest.toml\");\nassert!(path.is_file(), \"kittest.toml must be a readable regular file\");\nassert!(!path.metadata().map(|m| m.permissions().readonly()).unwrap_or(true) || cfg!(unix), \"check read permissions\");","typeGuard":null,"tryCatchPattern":"// load_config panics; ensure the file is readable before running tests\nmatch std::fs::File::open(\"kittest.toml\") {\n    Ok(_) => run_kittest_tests(),\n    Err(e) => eprintln!(\"config unreadable, fix before testing: {e}\"),\n}","preventionTips":["Commit config files with permissive read modes (644)","Never point kittest.toml at a directory or broken symlink","Verify file permissions in CI setup steps before running tests","Delete the config if you want defaults instead of a broken file"],"tags":["rust","filesystem","config","permissions","panic"],"backgroundTag":"file-read-failed","analyzedSha":"441971a776322a482e371775219380eca812cfa9","analyzedAt":"2026-09-12T04:29:21.500Z","contentChangedAt":"2026-09-12T04:29:21.500Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}