multica-ai/multica · warning

delete runtime: runtime has active agents bound to it (%s);

Error message

delete runtime: runtime has active agents bound to it (%s); rebind them to another runtime first, or rerun with --cascade to unbind them and delete the runtime (the agents and their history are kept)

What it means

The structured conflict branch of runRuntimeDelete: the server rejected DELETE /api/runtimes/{id} because active agents are still bound to the runtime, runtimeDeleteConflict parsed the agent list, and the --cascade flag was not passed. The message names the bound agents and offers the two supported resolutions: rebind them first, or rerun with --cascade to unbind and delete while preserving the agents and their history.

Source

Thrown at server/cmd/multica/cmd_runtime.go:240

	ctx, cancel := cli.APIContext(context.Background())
	defer cancel()

	err = client.DeleteJSON(ctx, "/api/runtimes/"+runtimeID)
	if err == nil {
		return printRuntimeDeleteResult(cmd, map[string]any{
			"id":      runtimeID,
			"deleted": true,
		})
	}

	conflict, ok := runtimeDeleteConflict(err)
	if !ok {
		return fmt.Errorf("delete runtime: %w", err)
	}

	cascade, _ := cmd.Flags().GetBool("cascade")
	if !cascade {
		return fmt.Errorf(
			"delete runtime: runtime has active agents bound to it (%s); rebind them to another runtime first, or rerun with --cascade to unbind them and delete the runtime (the agents and their history are kept)",
			strings.Join(conflict.AgentDisplays(), ", "),
		)
	}

	body := map[string]any{
		"expected_active_agent_ids": conflict.AgentIDs(),
	}
	var result map[string]any
	if err := client.PostJSON(ctx, "/api/runtimes/"+runtimeID+"/unbind-agents-and-delete", body, &result); err != nil {
		return fmt.Errorf("cascade delete runtime: %w", err)
	}
	result["id"] = runtimeID
	result["deleted"] = true
	return printRuntimeDeleteResult(cmd, result)
}

func runRuntimeRename(cmd *cobra.Command, args []string) error {

View on GitHub (pinned to 2c0912b6ec)

Solutions

  1. Preferred: rebind the listed agents to another runtime first (multica agent bind/rebind or the API), then re-run the delete.
  2. Alternatively: multica runtime delete <id> --cascade — the CLI then POSTs /unbind-agents-and-delete with expected_active_agent_ids; agents and history are kept, agents become unbound.
  3. If unsure, list agents bound to the runtime before deciding which path fits your workflow.

Example fix

# before
multica runtime delete rt_123
# delete runtime: runtime has active agents bound to it (agent-a, agent-b); ...

# after (option 1: rebind first)
multica agent rebind agent-a --runtime rt_9ab
multica agent rebind agent-b --runtime rt_9ab
multica runtime delete rt_123

# after (option 2: cascade)
multica runtime delete rt_123 --cascade
Defensive patterns

Strategy: validation

Validate before calling

cascade, _ := cmd.Flags().GetBool("cascade")
if !cascade {
	// pre-flight: list bound agents and rebind before deleting
	// GET /api/runtimes/<id>/agents -> rebind each -> then delete
}

Try / catch

err = client.DeleteJSON(ctx, "/api/runtimes/"+runtimeID)
if conflict, ok := runtimeDeleteConflict(err); ok {
	if !cascade {
		// decision point: rebind (safe) vs --cascade (unbind+delete, history kept)
		return fmt.Errorf("active agents: %s; rebind or pass --cascade", strings.Join(conflict.AgentDisplays(), ", "))
	}
}

Prevention

When it happens

Trigger: Running `multica runtime delete <id>` (no --cascade) while at least one agent is actively bound to that runtime; typically after decommissioning a runtime that still serves live agents.

Common situations: Decommissioning a provider/runtime during migration without first migrating its agents; forgetting that --cascade exists; wanting a safe default — the guard is intentional so operators do not accidentally orphan live agents.

Related errors


AI-assisted analysis of multica-ai/multica@2c0912b6ec (2026-08-15). Data as JSON: /api/errors/eb49167b81af8b0f. Report an issue: GitHub.