---
title: "MGS5004: this needs the persistent daemon"
description: Fires when a command that hands work to the daemon is run without one, or with only a per-process server that would exit before the work ran.
tags: [MGS5004, services, daemon, detach, background]
---

# MGS5004: this needs the persistent daemon

A command that HANDS OFF work - today `magus run --detach` and `magus affected --detach` -
was asked to do so with no persistent daemon to hand it to.

```text
[MGS5004] --detach hands the work to the daemon, and none is running; start one with `magus server start`
  see: .../MGS5004.md
```

## Why

`--detach` does not fork a background copy of magus. It submits the run to the daemon and
returns the job id, so the work outlives your shell and you can watch it instead of
blocking on it.

That only holds for the daemon `magus server start` creates. magus also stands up a
short-lived proc server for ordinary commands, and that one exits when the command that
started it exits - so work submitted there is queued and then silently dropped. You would
be told the run detached, and nothing would ever run it.

Refusing is the only honest answer available. magus cannot promise the work will happen
when the thing meant to do it is about to exit.

## Fix

Start the daemon, then detach:

```sh
magus server start
magus run ci --detach
```

Watch the queued work with:

```sh
magus status --watch 15s
```

## When you do not want a daemon

Drop `--detach` and run in the foreground. Every other magus command works with no daemon
at all; only handing work off requires one, because only handing work off needs something
still running afterwards to accept it.
