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
- Open the mention picker and re-select the agent — this refreshes eligibility and membership before send.
- Add the agent back to the destination channel (Invite) or have its owner update the respond_to policy to admit you, then retry.
- Remove the mention from the message and send without it.
- 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
- Always insert agent mentions through the picker so eligibility is checked at selection time.
- Re-run revalidation after any channel-membership or policy change before send.
- Never strip denied mentions silently — surface the denial and keep the draft.
- Keep directory/membership caches invalidated on agents-data-changed events.
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
- actor is not an active member
- an admin cannot ban or time out a community owner or fellow
- request has not crossed the explicit approval boundary
- target event belongs to a different channel
- must be event author or channel owner/admin
AI-assisted analysis of block/buzz@dad5a33865 (2026-09-05).
Data as JSON: /api/errors/3f60af9a95ca28d0.
Report an issue: GitHub.