block/buzz · error · AgentMentionAuthorizationError

Could not authorize a mentioned agent. Check its access and

Error message

Could not authorize a mentioned agent. Check its access and channel membership, then retry or remove the mention.

What it means

revalidateAgentMentionPubkeys re-checks, at send time, that every mentioned agent pubkey is admitted (access policy + channel membership). If any requested agent pubkey is missing from the admitted set, it throws AgentMentionAuthorizationError so the send fails closed instead of mentioning an agent that cannot or should not respond.

Source

Thrown at desktop/src/features/messages/lib/agentMentionRevalidation.ts:93

  });
  const admittedPubkeys = new Set(
    [...agentPubkeys].filter((pubkey) => {
      const isManagedAgent = managedPubkeys.has(normalizePubkey(pubkey));
      const directoryReady = isManagedAgent || relayDirectoryReady;
      return (
        getAgentMentionAdmission({
          isAgent: true,
          pubkey,
          mentionableAgentPubkeys: mentionablePubkeys,
          directoryReady,
        }) === "allow"
      );
    }),
  );
  if (
    [...requestedAgentPubkeys].some((pubkey) => !admittedPubkeys.has(pubkey))
  ) {
    throw new AgentMentionAuthorizationError();
  }
  return [...pubkeys];
}

export function useAgentMentionRevalidation({
  agentPubkeys,
  getSelectedAgentPubkeys,
  currentPubkey,
  eligibilityScope,
  sharedChannelIds,
  refetchManagedAgents,
}: {
  agentPubkeys: ReadonlySet<string>;
  getSelectedAgentPubkeys: () => ReadonlySet<string>;
  currentPubkey: string | null;
  eligibilityScope: AgentEligibilityScope;
  sharedChannelIds: ReadonlySet<string>;
  refetchManagedAgents: () => Promise<DirectoryResult<ManagedAgent[]>>;

View on GitHub (pinned to dad5a33865)

Solutions

  1. Open the mention picker and re-select the agent — this refreshes eligibility and membership before send.
  2. Add the agent back to the destination channel (Invite) or have its owner update the respond_to policy to admit you, then retry.
  3. Remove the mention from the message and send without it.
  4. If eligibility looks wrong, refresh the relay directory/membership caches and retry the send.

Example fix

// before
await sendMessage({ content, mentions: extracted.pubkeys });

// after
try {
  await sendMessage({ content, mentions: extracted.pubkeys });
} catch (e) {
  if (e instanceof AgentMentionAuthorizationError) {
    toast.error("A mentioned agent is not authorized here. Re-pick the mention or remove it.");
    return; // keep the draft
  }
  throw e;
}
Defensive patterns

Strategy: try-catch

Validate before calling

const admitted = await revalidateAgentMentionPubkeys({ pubkeys, channelId }); // pre-check before submit
if (admitted.length < pubkeys.length) promptMentionPicker();

Type guard

function isAgentMentionAuthError(e: unknown): e is AgentMentionAuthorizationError {
  return e instanceof AgentMentionAuthorizationError;
}

Try / catch

try {
  await send();
} catch (e) {
  if (isAgentMentionAuthError(e)) {
    toast.error("A mentioned agent lost access to this channel. Re-pick or remove the mention.");
    return; // preserve draft
  }
  throw e;
}

Prevention

When it happens

Trigger: Sending/editing a message whose @agent mention fails send-time revalidation: the agent's respond_to policy no longer admits the viewer, the agent is not a member of the destination channel, or the directory/membership query returned no evidence for the pubkey.

Common situations: Agent was removed from the channel after the mention was typed; shared agent's allowlist/anyone policy changed; relay membership or directory cache is stale; editing an old message that still mentions a since-removed agent.

Related errors


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