paperclipai/paperclip · error · TeamsAdapterCompatibilityError

file-consent runtime is not enabled

Error message

file-consent runtime is not enabled

What it means

sendTeamsFileCard (used by sendTeamsFileConsentCard and sendTeamsUploadedFileCard) requires two things: the runtime was created with the Teams file-consent feature enabled (this.teamsFileConsentEnabled) and the adapter exposes paperclipSendFileCard. If either is missing, the file-consent runtime is considered off and a TeamsAdapterCompatibilityError is thrown instead of attempting to send a consent/file card.

Source

Thrown at server/src/services/chat-sdk-runtime.ts:2586

  async sendTeamsUploadedFileCard(
    threadId: string,
    card: ReturnType<typeof buildTeamsUploadedFileCard>,
  ): Promise<{ id: string }> {
    return await this.sendTeamsFileCard(threadId, "file_info", card);
  }

  private async sendTeamsFileCard(
    threadId: string,
    kind: "consent" | "file_info",
    card: unknown,
  ): Promise<{ id: string }> {
    const teams = this.adapter as unknown as TeamsAdapterInternals;
    if (
      !this.teamsFileConsentEnabled ||
      typeof teams.paperclipSendFileCard !== "function"
    ) {
      throw new TeamsAdapterCompatibilityError(
        "file-consent runtime is not enabled",
      );
    }
    return await teams.paperclipSendFileCard(threadId, kind, card);
  }

  channel(channelId: string): Channel {
    return this.chat.channel(channelId);
  }

  async openDirectMessage(user: string | Author): Promise<Thread> {
    return await this.chat.openDM(user);
  }

  async getUser(user: string | Author): Promise<UserInfo | null> {
    return await this.chat.getUser(user);
  }

View on GitHub (pinned to 01ad858492)

Solutions

  1. Enable the Teams file-consent runtime option when constructing/annotating the endpoint runtime.
  2. Upgrade the microsoft-teams adapter to one implementing paperclipSendFileCard.
  3. Feature-detect (adapter hook present AND consent enabled) before calling, and fall back to a plain text message linking the file.
  4. Verify configuration/env that feeds teamsFileConsentEnabled at startup.

Example fix

// before
await runtime.sendTeamsFileConsentCard(threadId, card);

// after
const teams = runtime.getProviderAdapter() as {
  paperclipSendFileCard?: unknown;
};
if (runtime.teamsFileConsentEnabled && typeof teams.paperclipSendFileCard === "function") {
  await runtime.sendTeamsFileConsentCard(threadId, card);
} else {
  await runtime.thread(threadId).post(fileLinkText);
}
Defensive patterns

Strategy: validation

Validate before calling

const teams = runtime.getProviderAdapter() as Record<string, unknown>;
const canSendFileCard = (runtime as { teamsFileConsentEnabled?: boolean }).teamsFileConsentEnabled === true && typeof teams.paperclipSendFileCard === "function";
if (!canSendFileCard) throw new Error("teams file-consent not available; use plain message");

Type guard

function supportsTeamsFileCards(r: unknown): boolean {
  const rt = r as { teamsFileConsentEnabled?: boolean; getProviderAdapter?: () => unknown };
  const a = rt.getProviderAdapter?.() as { paperclipSendFileCard?: unknown } | undefined;
  return rt.teamsFileConsentEnabled === true && typeof a?.paperclipSendFileCard === "function";
}

Try / catch

try {
  await runtime.sendTeamsFileConsentCard(threadId, card);
} catch (err) {
  if (err instanceof TeamsAdapterCompatibilityError && err.message.includes("file-consent runtime is not enabled")) {
    await runtime.thread(threadId).post(fileLinkText);
  } else throw err;
}

Prevention

When it happens

Trigger: Calling sendTeamsFileConsentCard or sendTeamsUploadedFileCard when: (1) the endpoint runtime was built without the file-consent option (teamsFileConsentEnabled false), or (2) the microsoft-teams adapter lacks paperclipSendFileCard.

Common situations: Deployments where the Teams file-consent runtime flag was never enabled in endpoint configuration but upload code paths call it; older Teams adapters predating the file-card hook; tests constructing the runtime without the consent option.

Related errors


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