{"record":{"id":"b175660799ef42fe","repo":"emilk/egui","slug":"error-msg","errorCode":null,"errorMessage":"ERROR: {msg}","messagePattern":"ERROR: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"crates/eframe/src/web/web_logger.rs","lineNumber":65,"sourceCode":"        let msg = if let (Some(file), Some(line)) = (record.file(), record.line()) {\n            let file = shorten_file_path(file);\n            format!(\"[{}] {file}:{line}: {}\", record.target(), record.args())\n        } else {\n            format!(\"[{}] {}\", record.target(), record.args())\n        };\n\n        match record.level() {\n            // NOTE: the `console::trace` includes a stack trace, which is super-noisy.\n            log::Level::Trace => console::debug(&msg),\n\n            log::Level::Debug => console::debug(&msg),\n            log::Level::Info => console::info(&msg),\n            log::Level::Warn => console::warn(&msg),\n\n            // Using console.error causes crashes for unknown reason\n            // https://github.com/emilk/egui/pull/2961\n            // log::Level::Error => console::error(&msg),\n            log::Level::Error => console::warn(&format!(\"ERROR: {msg}\")),\n        }\n    }\n\n    fn flush(&self) {}\n}\n\n/// js-bindings for console.log, console.warn, etc\nmod console {\n    use wasm_bindgen::prelude::*;\n\n    #[wasm_bindgen]\n    extern \"C\" {\n        /// `console.trace`\n        #[wasm_bindgen(js_namespace = console)]\n        pub fn trace(s: &str);\n\n        /// `console.debug`\n        #[wasm_bindgen(js_namespace = console)]","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/emilk/egui/blob/441971a776322a482e371775219380eca812cfa9/crates/eframe/src/web/web_logger.rs#L47-L83","documentation":"eframe's web logger routes log::Level::Error records to console.warn(format!(\"ERROR: {msg}\")) instead of console.error, because calling console.error crashed browsers (see egui PR #2961). So a JavaScript console line reading \"ERROR: ...\" is a warning-level console message produced by this fallback — the actual failure is whatever msg contains; the library deliberately downgrades the severity to avoid the crash.","triggerScenarios":"Any log::error!(...) (or an error-level log from a dependency) executed inside an eframe web/wasm app while this logger is installed — the message is emitted via console.warn with the \"ERROR: \" prefix rather than console.error.","commonSituations":"Debugging a wasm eframe app whose console shows ERROR: lines without matching JS error objects (breakpoints on console.error never fire); confusion in error monitoring that filters on console.error and therefore misses these; hitting the original console.error browser crash on older toolchains.","solutions":["Treat console lines with the \"ERROR: \" prefix as real errors when triaging wasm app logs","Find and fix the root cause reported in msg — the prefix line itself is only the transport","Install a custom log implementation (log::set_boxed_logger) if you need console.error or structured error reporting (e.g. forwarding to Sentry)","Check for an updated eframe where the console.error crash (PR #2961) is fixed and the workaround removed"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// Intercept error-level logs in wasm before the default web logger:\nstruct SentryLogger;\nimpl log::Log for SentryLogger {\n    fn enabled(&self, m: &log::Metadata) -> bool { m.level() <= log::Level::Trace }\n    fn log(&self, r: &log::Record) {\n        if r.level() == log::Level::Error { send_to_sentry(&format!(\"{}\", r.args())); }\n        else { console::log_1(&format!(\"{}\", r.args()).into()); }\n    }\n    fn flush(&self) {}\n}\nlet _ = log::set_boxed_logger(Box::new(SentryLogger));","preventionTips":["Filter browser consoles on the \"ERROR: \" prefix, not console.error, when triaging eframe wasm apps","Install a custom log implementation if you need real console.error or error-tracking integration","Fix the root cause in msg — the prefixed warn line is only the transport, not the bug","Track egui releases for removal of the console.error crash workaround (PR #2961)"],"tags":["logging","wasm","web","eframe"],"backgroundTag":"logging-fallback","analyzedSha":"441971a776322a482e371775219380eca812cfa9","analyzedAt":"2026-09-12T04:29:21.500Z","contentChangedAt":"2026-09-12T04:29:21.500Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}