---
title: "MGS1045: a magus\\guard.spawn, command or write registration is unusable"
description: Fires when magus\guard.spawn, magus\guard.command or magus\guard.write is handed something other than a function, is called twice in one load, or is called from a magusfile other than the root one. The workspace does not load.
tags: [MGS1045, magusfile, guard, agents, spawn, command, write]
---

# MGS1045: a magus\guard.spawn, command or write registration is unusable

The root magusfile registers a spawn, command or write rule in a way magus cannot use:

```text
[error] [MGS1045] magus\guard.spawn: already registered in this magusfile; a workspace
has one such rule, so fold the second one into the first
```

## Why

`magus\guard.spawn`, `magus\guard.command` and `magus\guard.write` each hand the agent
guard one function to call on every spawn, every shell command, or every file write. A registration that is ignored is worse
than none: the workspace reads as guarded and nothing is judged. So each of these stops
the load instead:

- the argument is not a function;
- a second call to the same member in the same load, which would leave it unclear which
  rule runs;
- a call from a project's magusfile rather than the workspace root's, since the rule
  answers for every agent in the workspace.

## What to do

Register exactly one function per member, from the root `magusfile.buzz`. To combine
several checks, call them from that one function and return the strictest answer. See
[magus\guard.spawn](../../guard-spawn.md) and [magus\guard.command](../../guard-command.md).
