{"id":"404fe4d57c47239f","repo":"rust-lang/cargo","slug":"see-above","errorCode":null,"errorMessage":"see above","messagePattern":"see above","errorType":"exception","errorClass":"AlreadyPrintedError","httpStatus":null,"severity":"error","filePath":"src/diagnostics/mod.rs","lineNumber":110,"sourceCode":"    pub fn scope(&mut self) -> ScopedDiagnosticStats<'_> {\n        ScopedDiagnosticStats {\n            warning_count: 0,\n            error_count: 0,\n            global: self,\n        }\n    }\n\n    pub fn error_count(&self) -> usize {\n        self.error_count\n    }\n\n    pub fn lint_warning_count(&self) -> usize {\n        self.lint_warning_count\n    }\n\n    pub fn ok(&self) -> CargoResult<PassOutput> {\n        if 0 < self.error_count {\n            Err(crate::Error::new(crate::AlreadyPrintedError::new(\n                anyhow::format_err!(\"see above\"),\n            )))\n        } else {\n            Ok(PassOutput {\n                lint_warning_count: self.lint_warning_count,\n            })\n        }\n    }\n}\n\npub struct ScopedDiagnosticStats<'g> {\n    warning_count: usize,\n    error_count: usize,\n    global: &'g mut GlobalDiagnosticStats,\n}\n\nimpl ScopedDiagnosticStats<'_> {\n    pub fn warning_count(&self) -> usize {","sourceCodeStart":92,"sourceCodeEnd":128,"githubUrl":"https://github.com/rust-lang/cargo/blob/0e07a155371a6ce88ae53a2c00df940280c09a67/src/diagnostics/mod.rs#L92-L128","documentation":"This is NOT a real error message — it is the `AlreadyPrintedError` sentinel returned by `GlobalDiagnosticStats::ok` (src/diagnostics/mod.rs:108) when `error_count > 0`. Cargo has already printed the substantive diagnostics to the shell; the top-level `CargoResult` still needs an `Err` variant, so it wraps the literal string `\"see above\"` to tell the user the real cause was already displayed.","triggerScenarios":"Any cargo command that records errors via the diagnostics system and then calls `gds.ok()` to convert to a final result. The 'see above' error appears as the process exit reason whenever one or more earlier errors were already reported.","commonSituations":"Build/test failures where multiple compile errors were shown; the terminal scrolled past the real error; JSON message format showing `\"see above\"` as the final error because prior structured messages held the detail; scripts capturing only the last error line.","solutions":["Scroll up or re-run and capture full output — the actual error was printed before this sentinel.","Pipe output to a file (`cargo build 2>&1 | tee build.log`) and search for the first error.","Use `--message-format=json` and parse all messages, not just the final exit error."],"exampleFix":"# capture full output instead of relying on the last line\ncargo build 2>&1 | tee build.log\n# then inspect the first diagnostic, not the 'see above' sentinel","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// Cargo commands return CargoResult; on Err, do not treat 'see above' as the cause —\n// capture full stderr and surface the first real diagnostic.\nlet output = std::process::Command::new(\"cargo\").args(&[\"build\"]).output()?;\nif !output.status.success() {\n    let stderr = String::from_utf8_lossy(&output.stderr);\n    let first_err = stderr.lines().find(|l| l.contains(\"error[\"));\n    // report first_err, not the trailing 'see above'\n}","preventionTips":["Always capture full cargo output, not just the exit error.","Use JSON message format and parse all messages programmatically.","In logs, surface the first diagnostic line, not the last."],"tags":["cargo","diagnostics","sentinel","output"],"analyzedSha":"0e07a155371a6ce88ae53a2c00df940280c09a67","analyzedAt":"2026-08-06T01:46:58.334Z","schemaVersion":2}