multica-ai/multica · error
delete runtime: %w
Error message
delete runtime: %w
What it means
runRuntimeDelete first attempts client.DeleteJSON on /api/runtimes/{id}; on failure it inspects the error with runtimeDeleteConflict. This error is the non-conflict path: the DELETE failed for an ordinary reason (404 unknown runtime, 401/403, transport, decode) rather than the active-agents conflict, so it is re-wrapped as "delete runtime: %w".
Source
Thrown at server/cmd/multica/cmd_runtime.go:235
if err != nil {
return err
}
runtimeID := args[0]
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"] = runtimeIDView on GitHub (pinned to 2c0912b6ec)
Solutions
- Check the wrapped cause: 404 means it is already gone (nothing to do), 401/403 means re-auth or use an authorized account.
- Refresh the ID via `multica runtime list` and retry if it was a stale reference.
- If the wrapped body looks like an agent-conflict but was not detected, compare CLI and server versions — the conflict payload format may have changed.
Example fix
# before multica runtime delete rt_123 # "delete runtime: ... 404" # after multica runtime list # confirm whether rt_123 still exists multica runtime delete rt_9ab # use current ID
Defensive patterns
Strategy: try-catch
Try / catch
err = client.DeleteJSON(ctx, "/api/runtimes/"+runtimeID)
if err != nil && !runtimeDeleteConflict(err) {
var status cli.HTTPStatusError
if errors.As(err, &status) && status.Code == 404 {
return nil // already deleted: treat as success
}
return fmt.Errorf("delete runtime: %w", err)
} Prevention
- Treat 404 on delete as idempotent success in automation.
- Refresh runtime IDs from list output before deleting.
- Ensure the account has delete permission before scripting decommissions.
When it happens
Trigger: Deleting a runtime ID that does not exist (404); insufficient permission (403); expired token; server unreachable; a response shape that runtimeDeleteConflict cannot parse as a conflict (falling through to this branch).
Common situations: Runtime already deleted by another operator; stale ID from an old listing; read-only service accounts attempting deletion.
Related errors
AI-assisted analysis of multica-ai/multica@2c0912b6ec (2026-08-15).
Data as JSON: /api/errors/98b3c099bc7a419b.
Report an issue: GitHub.