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

MGS1006: unknown target

A target was referenced by a name that no project in scope declares. This happens two ways:

  • From the CLI - magus run <name> (or magus x <name>) where <name> matches no target anywhere in the selected scope.
  • From a magusfile - a dependency handle such as ctx.needs(<name>) names a target that does not exist.
[MGS1006] magusfile: unknown target "build" (registered: build, lint, test)
  see: .../MGS1006.md

Why

A target is an exported function in a magusfile (normalized to a kebab-case name). Magus resolves a referenced target by that name; when nothing declares it, there is nothing to run. The message lists the targets that ARE registered in scope so a typo is obvious at a glance.

Note that during a normal fan-out run (magus run build, magus affected ci), a project that simply does not declare the requested target is silently skipped, not reported as unknown - that is expected in a multi-project workspace. MGS1006 is the terminal case: the name resolves to no target at all in the selected scope.

Resolution

  • Typo? Compare against the registered: list in the message, or run magus describe targets to see every target and the project that declares it.

  • Wrong scope? The target may live in a project outside the current selection. Run from the workspace root, or widen the scope.

  • Not defined yet? Declare it as an exported function in the project's magusfile:

    export fun build(ctx: magus\Context, _a: [str]) > void { go["go-build"](ctx); }
    
  • Dependency handle. ctx.needs(x) takes a target FUNCTION handle in the same magusfile; a cross-project dependency uses the imported project's handle (import "project/api" as api; ... ctx.needs(api.build);). A bare unresolved name raises this diagnostic.

What this is NOT

  • Not a missing spell. A spell provides ops, not targets. If the name you meant is a spell op, invoke it through a target, not directly.
  • Not the empty-affected-set no-op. magus affected ci with no changed projects runs nothing and does not raise MGS1006.

See also

  • targets: the anatomy of a magus target.
  • magus describe targets: every target and where it is declared.
MGS1006magusfiletargetsneedsdependsauthoring
Last updated (a170f9b2)
Earlier changes on this page (3)

Full history ↗ · Blame source ↗

Glossary

Workspace

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

Project

A directory magus recognizes as a unit of work (it has a magusfile); the unit of caching, scheduling, and dependency tracking. See workspace.

Magusfile

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

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. See targets.

Spell

A language/runtime adapter (e.g. go, md) that maps generic targets onto a toolchain's real commands. See spells.

Buzz

The language magusfiles are written in (the .buzz engine). See engines.

Affected

The set of projects touched by a change; magus affected <target> runs a target only over them. See affected.

CI

An ordinary magusfile-defined target you compose yourself with magus\needs - magus does not hardcode its stages. Magus.RunCI treats it specially only in that it strips the rw charm, it is the anchor magus affected ci keys off, and a selected scope with no project declaring it is a load error rather than a silent no-op. See targets.

Conventions

Placeholders

Angle brackets mark a value you replace with your own - never type the brackets:

magus run <target>
magus completion <shell>    # e.g. bash, zsh, fish

<target>, <path>, <shell>, <name> and the like are stand-ins, not literal text.