rust-lang/cargo · error · AlreadyPrintedError
see above
Error message
see above
What it means
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.
Source
Thrown at src/diagnostics/mod.rs:110
pub fn scope(&mut self) -> ScopedDiagnosticStats<'_> {
ScopedDiagnosticStats {
warning_count: 0,
error_count: 0,
global: self,
}
}
pub fn error_count(&self) -> usize {
self.error_count
}
pub fn lint_warning_count(&self) -> usize {
self.lint_warning_count
}
pub fn ok(&self) -> CargoResult<PassOutput> {
if 0 < self.error_count {
Err(crate::Error::new(crate::AlreadyPrintedError::new(
anyhow::format_err!("see above"),
)))
} else {
Ok(PassOutput {
lint_warning_count: self.lint_warning_count,
})
}
}
}
pub struct ScopedDiagnosticStats<'g> {
warning_count: usize,
error_count: usize,
global: &'g mut GlobalDiagnosticStats,
}
impl ScopedDiagnosticStats<'_> {
pub fn warning_count(&self) -> usize {View on GitHub (pinned to 0e07a15537)
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.
Example fix
# capture full output instead of relying on the last line cargo build 2>&1 | tee build.log # then inspect the first diagnostic, not the 'see above' sentinel
Defensive patterns
Strategy: try-catch
Try / catch
// Cargo commands return CargoResult; on Err, do not treat 'see above' as the cause —
// capture full stderr and surface the first real diagnostic.
let output = std::process::Command::new("cargo").args(&["build"]).output()?;
if !output.status.success() {
let stderr = String::from_utf8_lossy(&output.stderr);
let first_err = stderr.lines().find(|l| l.contains("error["));
// report first_err, not the trailing 'see above'
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- not implemented
- argument for --color must be auto, always, or never, but fou
- no executable for `{}` found in PATH
- subcommand is required, add a subcommand to the command alia
- alias {} has unresolvable recursive definition: {} -> {}
AI-assisted analysis of rust-lang/cargo@0e07a15537 (2026-08-06).
Data as JSON: /data/errors/404fe4d57c47239f.json.
Report an issue: GitHub.