block/buzz · error · Error

This agent is present on the relay. Starting another instanc

Error message

This agent is present on the relay. Starting another instance is unavailable.

What it means

In useAgentLifecycleActions' primary-action path, after a stop branch the code re-checks agentPresenceStartBlockReason with lifecycleActive=false. If relay presence still reports the agent online/away, starting (or stop-then-restart) is refused with the same presence-block error: the relay already sees this identity, so a new instance is disallowed.

Source

Thrown at desktop/src/features/profile/ui/useAgentLifecycleActions.ts:53

    if (!managedAgent) return;

    try {
      if (isManagedAgentActive(managedAgent)) {
        const result = await stopManagedAgentWithRules({
          agent: managedAgent,
          channels: channels ?? [],
          relayAgents: relayAgents ?? [],
          stopManagedAgent,
        });
        if (managedAgent.backend.type === "local") {
          clearActiveTurnsForAgentOnStop(managedAgent.pubkey);
        }
        toast.success(result.noticeMessage ?? `Stopped ${managedAgent.name}.`);
        return;
      }

      const blockReason = agentPresenceStartBlockReason(false, availability);
      if (blockReason) throw new Error(blockReason);
      await startManagedAgentWithRules({
        agent: managedAgent,
        startManagedAgent,
      });
      toast.success(
        managedAgent.backend.type === "provider"
          ? `Deploying ${managedAgent.name}.`
          : `Started ${managedAgent.name}.`,
      );
    } catch (error) {
      toast.error(
        error instanceof Error ? error.message : "Agent action failed.",
      );
    }
  }, [
    availability,
    channels,
    managedAgent,

View on GitHub (pinned to dad5a33865)

Solutions

  1. Wait for presence to report offline after stopping (presence invalidates asynchronously) and retry the action.
  2. Locate and stop the other running instance (other device/session) before starting locally.
  3. If the connection degraded, reconnect so resolveAgentAvailability returns fresh data instead of stale online.
  4. Confirm the local record is inactive and refresh the agent inventory if state looks inconsistent.

Example fix

// before
const blockReason = agentPresenceStartBlockReason(false, availability);
if (blockReason) throw new Error(blockReason);
await startManagedAgentWithRules({ agent: managedAgent, startManagedAgent });

// after
const blockReason = agentPresenceStartBlockReason(false, availability);
if (blockReason) {
  toast.error(blockReason);
  return; // or: await refreshPresence([managedAgent.pubkey]) then re-check once
}
await startManagedAgentWithRules({ agent: managedAgent, startManagedAgent });
Defensive patterns

Strategy: validation

Validate before calling

const blockReason = agentPresenceStartBlockReason(false, availability);
if (blockReason) { toast.error(blockReason); return; }

Type guard

const primaryActionAllowed = (a: ManagedAgent): boolean =>
  agentPresenceStartBlockReason(false, availabilityFor(a.pubkey)) === undefined;

Try / catch

try {
  await handleAgentPrimaryAction(managedAgent);
} catch (e) {
  if (e instanceof Error && e.message.includes("present on the relay")) {
    toast.info("Agent is running elsewhere — stop that instance first.");
    return;
  }
  throw e;
}

Prevention

When it happens

Trigger: Clicking the agent's primary Start action (or restart whose stop path ran) while the presence lookup returns 'online' or 'away' for the agent's pubkey — e.g. another device is running it or presence hasn't cleared after a stop.

Common situations: Restarting an agent whose stop succeeded locally but whose relay presence hasn't flipped offline yet; starting an agent deployed on another machine; degraded connection serving a stale presence snapshot.

Related errors


AI-assisted analysis of block/buzz@dad5a33865 (2026-09-05). Data as JSON: /api/errors/d89a67e411155521. Report an issue: GitHub.