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

MGS3003: tool not on PATH

proc\which could not resolve a command. The tool is not installed, or not visible to this run: a sandboxed target sees a curated PATH, so "installed on your machine" and "reachable from here" are different questions.

[MGS3003] "docker" is not on PATH: exec: "docker": executable file not found in $PATH

Why this raises instead of returning ""

proc\which used to answer "" for a missing command so a magusfile could branch on proc\which(cmd) == "". That put the check on every call site and made it optional: skip it and the empty string flows straight into an proc\exec or a path join, and the failure surfaces as something unrelated.

Resolution

Wrap it where a missing tool is a case you want to explain. The point of checking at all is to replace a cryptic exec failure with a sentence that says how to fix it:

try {
    proc\which("docker");
} catch (e) {
    throw "completion-test needs a docker daemon: it runs each shell's official image";
}

If the tool should always be present, do not catch. The raised error already names the command and the reason, which is a better failure than a downstream exec error nobody can trace back.

Pinning the tool instead

A tool a target needs should usually be pinned in mise.toml rather than assumed. A pinned tool is installed by mise install in CI and resolves the same way on every machine, which turns this diagnostic from a routine occurrence into a genuine misconfiguration.

Catching it by code

try {
    final p = proc\which("docker");
} catch (e) {
    if (e["code"] == "MGS3003") {
        magus\log.info("docker is not available; skipping the container checks");
    }
}
MGS3003pathtoolshost-moduleserrorsmagusfile
Last updated (895d94e4)
Earlier changes on this page (3)

Full history ↗ · Blame source ↗

Glossary

Magusfile

The magusfile.buzz that declares a project's targets (as export funs) and binds its spells. Magusfile in full.

Target

A named operation (build, test, ...) you invoke with magus run <target>; it may compose a spell's tool-native operations and depend on other targets. Target in full.

Op

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

Module

A magus stdlib namespace a magusfile imports for host capabilities: filesystem, exec, vcs, and more. Module in full.

Buzz

The language magusfiles are written in (the .buzz engine). Buzz in full.

Sandbox

The restricted filesystem and environment a target runs in, so builds stay reproducible and side-effect-free. Sandbox in full.

Daemon

The background process a person starts with magus server start. It serves MCP, the console, background jobs and the warm knowledge graph, and adopts nested magus calls into one pool. Daemon in full.

CI

An ordinary target you compose yourself with ctx.needs; magus does not hardcode its stages. It is the anchor magus affected ci keys off, and ci strips the rw charm. CI in full.

Trace

OpenTelemetry's name for one whole magus invocation; every target it runs is a span beneath it. Trace in full.

Tool

An action a model can call through its host: a name, a description, a typed input and a result. magus serves its tools over MCP, each a read of the workspace model or a run of the CLI it already has. Tool in full.

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. Run in full.

Conventions

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