Error return value ignored or silently discarded

May 15, 2026 · View on GitHub

Playbook ID: missing-error-propagation Category: runtime Severity: high Tags: source, error-handling, go, silent-failure, observability

What this failure means

An error return from an I/O, database, or side-effecting call is discarded with _ = or silently overwritten, so failures pass undetected.

Common log signals

(This playbook uses source-code pattern matching rather than log signals.)

Diagnosis

A function returns an error that is discarded with _ = or left unchecked. Failures in I/O, database, or side-effecting operations pass silently.

Common patterns that trigger this:

  • _ = db.Exec(...) — database write result dropped
  • _ = f.Write(...) — file write error ignored
  • _, _ = someFunc() — both returns discarded in a multi-return call
  • err = nil — error forced to nil before the check

The risk is highest when the ignored call produces a side effect that the caller assumes succeeded (for example, a committed transaction, a written file, or a deleted record).

Fix steps

  1. Propagate the error to the caller — wrap it with context: return fmt.Errorf("context: %w", err).
  2. If the error genuinely cannot affect correctness, document why with a comment and log it at WARN level.
  3. Use errcheck in CI to catch ignored error returns statically.
  4. If you already run Staticcheck, treat SA4006 as a companion signal for overwritten values, but do not rely on it as the primary ignored-error check.

Validation

  • Re-run the failing workflow step.
  • Confirm the original failure signature for Error return value ignored or silently discarded is gone.

Likely files to inspect

  • service.go
  • handler.go
  • client.go
  • repository.go
  • cmd/*.go

Run Faultline

faultline analyze build.log
faultline explain missing-error-propagation
faultline workflow build.log --json --mode agent

Search phrases this page answers

  • Error return value ignored or silently discarded
  • Runtime: error return value ignored or silently discarded
  • faultline explain missing-error-propagation
  • Go error return value ignored or silently discarded

Generated from playbooks/bundled/source/missing-error-propagation.yaml. Do not edit directly — run make docs-generate.