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

Same family as error 0: useMembersSidebarActions' assertStartNotBlockedByPresence throws when starting an agent from the channel members sidebar whose pubkey reports online/away relay presence. It guards both handleLifecycleAction and handleRespawnAll so the UI never spawns a duplicate agent body for an identity the relay already sees as present.

Source

Thrown at desktop/src/features/channels/ui/useMembersSidebarActions.ts:73

export function useMembersSidebarActions({
  channelId,
  getAvailability,
  controllableManagedBots,
  removableManagedBots,
  currentPubkey,
  onOpenChange,
  relayUrl,
}: UseMembersSidebarActionsOptions) {
  const queryClient = useQueryClient();
  function assertStartNotBlockedByPresence(
    agent: ManagedAgent,
    lifecycleActive: boolean,
  ) {
    const reason = agentPresenceStartBlockReason(
      lifecycleActive,
      getAvailability(agent.pubkey),
    );
    if (reason) throw new Error(reason);
  }
  const removeMemberMutation = useRemoveChannelMemberMutation(channelId);
  const startManagedAgentMutation = useStartManagedAgentMutation();
  const stopManagedAgentMutation = useStopManagedAgentMutation();
  const runtimeActionMutation = useManagedAgentRuntimeAction();
  const [actionNoticeMessage, setActionNoticeMessage] = React.useState<
    string | null
  >(null);
  const [actionErrorMessage, setActionErrorMessage] = React.useState<
    string | null
  >(null);
  const [activeActionKey, setActiveActionKey] = React.useState<string | null>(
    null,
  );

  const stoppableManagedBots = React.useMemo(
    () =>
      controllableManagedBots.filter((agent) => isManagedAgentActive(agent)),

View on GitHub (pinned to dad5a33865)

Solutions

  1. Stop the running instance wherever it lives, wait for presence to report offline, then retry the sidebar action.
  2. Confirm the presence snapshot is fresh (app connected, presence query settled) before retrying.
  3. For respawn-all, exclude or skip agents whose availability is online/away instead of failing the whole batch.
  4. If presence is stale (agent confirmed dead), refresh presence/agent caches and retry.

Example fix

// before
await startManagedAgentMutation.mutateAsync(agent.id);

// after
const reason = agentPresenceStartBlockReason(lifecycleActive, getAvailability(agent.pubkey));
if (reason) {
  setActionNoticeMessage(reason);
  return;
}
await startManagedAgentMutation.mutateAsync(agent.id);
Defensive patterns

Strategy: validation

Validate before calling

const reason = agentPresenceStartBlockReason(lifecycleActive, getAvailability(agent.pubkey));
if (reason) setActionNoticeMessage(reason); else void runLifecycleAction();

Type guard

const startable = (agent: ManagedAgent, active: boolean): boolean =>
  !agentPresenceStartBlockReason(active, getAvailability(agent.pubkey));

Try / catch

try {
  await handleLifecycleAction(agent);
} catch (e) {
  if (e instanceof Error && e.message.includes("present on the relay")) {
    setActionNoticeMessage("Already running on the relay — stop the other instance first.");
    return;
  }
  throw e;
}

Prevention

When it happens

Trigger: Invoking a start/respawn lifecycle action from the members sidebar for a channel member whose normalized pubkey is in the presence snapshot with status 'online' or 'away', while the local lifecycle state is inactive.

Common situations: Respawning all channel agents when one is already running on another machine; starting a shared/relay-deployed agent owned elsewhere; presence snapshot hasn't caught up after someone else stopped the agent.

Related errors


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