paperclipai/paperclip · error · PermissionError

PERMISSION_DENIED

PERMISSION_DENIED

Error message

PERMISSION_DENIED

What it means

Thrown by sendTelegramCallbackNotice in chat-telegram-ephemeral.ts when the Telegram Bot API answers HTTP 403 to a private-response callback send. It means Telegram's destination refused the delivery — typically the chat became inaccessible, the bot was blocked, or the target user/chat is no longer reachable — so the ephemeral response cannot be delivered. It is raised as a PermissionError with adapter=telegram and status=403.

Source

Thrown at server/src/services/chat-telegram-ephemeral.ts:335

          ? Math.min(body.parameters.retry_after, 3600)
          : 1;
      throw Object.assign(new Error("Telegram private response rate limited"), {
        name: "RateLimitError",
        adapter: "telegram",
        status: 429,
        retryAfter,
      });
    }
    if (status === 401)
      throw Object.assign(new Error("Telegram authentication rejected"), {
        name: "AuthenticationError",
        adapter: "telegram",
        status: 401,
      });
    if (status === 403)
      throw Object.assign(new Error("Telegram destination rejected"), {
        name: "PermissionError",
        code: "PERMISSION_DENIED",
        adapter: "telegram",
        status: 403,
      });
    if (status >= 400 && status < 500) throw reject();
    throw unknown();
  }
  const result = body.result;
  if (
    !record(result) ||
    !record(result.chat) ||
    String(result.chat.id) !== receipt.chatId ||
    (result.message_thread_id ?? null) !== receipt.messageThreadId ||
    !record(result.from) ||
    String(result.from.id) !== receipt.botUserId ||
    result.from.is_bot !== true
  )
    throw unknown();
  if (receipt.chatType === "private") {

View on GitHub (pinned to 01ad858492)

Solutions

  1. Catch PermissionError for adapter telegram/status 403 and mark the ephemeral response as permanently undeliverable instead of retrying
  2. Check bot chat permissions (bot blocked, kicked from chat) via getChat/getChatMember to confirm the cause before giving up
  3. Surface the delivery failure in the activity/run log so the operator knows the Telegram side never saw the response
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at server/src/services/chat-telegram-ephemeral.ts:335 when the library encounters an invalid state.

Common situations: See trigger scenarios.

Understand the failure class

Background: Permission denied / not authorized / 403 Forbidden: access-control rejections when the caller lacks the required role, grant, or ownership — this error's family across 18 libraries.


AI-assisted analysis of paperclipai/paperclip@01ad858492 (2026-09-10). Data as JSON: /api/errors/936f714b17fef10a. Report an issue: GitHub.