magus v0.4.3 is out. See what's new
¶ View markdown source · ✎ Suggest an edit
1 min read

MGS3030: pipe upstream failed

A shell reports a pipeline's status from its last stage only, unless set -o pipefail is on, and agents never turn it on. So a pipe of magus runs carries the status forward itself (see Piping one magus into another). Every magus stage whose stdout is a pipe records how it ended, and a run reading that pipe checks it twice.

Before it takes any lock, a run refuses to start after a proven upstream stage that has already failed:

[MGS3030] pid 40118 (magus run generate:rw libs/api), upstream of this run in a
  pipe, exited 1, so this run started nothing. A pipeline of magus runs stops at its
  first failed stage: fix that stage, then run the pipeline again.

A run that succeeded waits for every proven upstream stage to end before it exits, and fails with the first one that did not:

[MGS3030] pid 40118 (magus run build libs/api), upstream of this run in a pipe,
  exited 2. This run succeeded, but the pipeline failed at that stage.

The exit status is the upstream's own, or 1 when a signal stopped it. A run that failed reports its own failure instead. An upstream that ended without recording its status, because it was killed or ran against another workspace, is named on stderr as unknown and does not fail the run.

Resolution

  • Fix the stage the message names, then run the pipeline again.
  • Run that stage on its own to see its failure in full; its output went to stderr above the refusal.

See also

  • MGS3023: a pipe whose writers loop back into the run reading it.
  • Concurrency: how one magus waits on another it reads from.
MGS3030lockspipepipefailstdinexit-status
Last updated (90ff3762)
Glossary

Workspace

The magus root directory that owns a set of projects and shared config; the unit magus operates over. See workspace.

Op

A single tool-native command a target composes (long form: operation); the middle of the work hierarchy (Spell to Op to Target). See operations.

Ward

A coded diagnostic that inspects a resolved op and nudges or blocks an anti-pattern before it runs. See wards.

Concurrency

How many targets run at once. It is bounded by the pool's capacity and set with --concurrency, MAGUS_CONCURRENCY, or the concurrency config key. See server.

Run

One target executing under one magus invocation, such as magus run test web or magus affected ci. A run keeps its captured output behind an output reference. Every magus run is a run whether or not any job asked for it; see Job for how the two relate.

Conventions

This page uses none of the site's convention markers. The full set is on the conventions page.