different-ai/openwork · error

t("providers.removal_unsupported")

Error message

t("providers.removal_unsupported")

What it means

removeProviderAuthCredentials tries three strategies to delete stored provider credentials from the connected opencode server: authClient.remove(), a raw DELETE /auth/:providerId, and finally authClient.set(providerID, auth: null). If the client object exposes none of these capabilities, the store concludes the connected server/client SDK version cannot remove credentials and throws this error. It is an API-surface/version-capability guard, not a server failure.

Source

Thrown at apps/app/src/react-app/domains/connections/provider-auth/store.ts:1234

      assertNoClientError(result);
      return;
    }

    const rawClient = (c as unknown as {
      client?: { delete?: (options: { url: string }) => Promise<unknown> };
    }).client;
    if (rawClient?.delete) {
      await rawClient.delete({ url: `/auth/${encodeURIComponent(providerId)}` });
      return;
    }

    if (typeof authClient.set === "function") {
      const result = await authClient.set({ providerID: providerId, auth: null });
      assertNoClientError(result);
      return;
    }

    throw new Error(t("providers.removal_unsupported"));
  };

  const describeProviderError = (error: unknown, fallback: string) => {
    const readString = (value: unknown, max = 700) => {
      if (typeof value !== "string") return null;
      const trimmed = value.trim();
      if (!trimmed) return null;
      if (trimmed.length <= max) return trimmed;
      return `${trimmed.slice(0, Math.max(0, max - 3))}...`;
    };

    const records: Record<string, unknown>[] = [];
    const root = error && typeof error === "object" ? (error as Record<string, unknown>) : null;
    if (root) {
      records.push(root);
      if (root.data && typeof root.data === "object") {
        records.push(root.data as Record<string, unknown>);
      }

View on GitHub (pinned to 2b7df46e8a)

Solutions

  1. Upgrade the opencode server and client SDK so c.auth.remove or c.auth.set exists.
  2. Verify options.client() returns the real SDK client, not a partial/stub object missing auth methods.
  3. If removal is genuinely unsupported, clear the credential server-side manually (e.g. delete the auth entry from opencode's auth storage) and refresh the store.
  4. In tests, use createTestStore with a client mock that implements auth.remove or auth.set.

Example fix

// before: stub client without auth methods
const client = { auth: {} };
// after: implement the removal surface
const client = { auth: { remove: async ({ providerID }) => ({ ok: true }) } };
Defensive patterns

Strategy: type-guard

Validate before calling

const authClient = client.auth as { remove?: unknown; set?: unknown };
const canRemove = typeof authClient?.remove === "function" || typeof authClient?.set === "function";
if (!canRemove) {
  showToast("This server version cannot remove stored credentials; upgrade opencode.");
}

Type guard

function supportsCredentialRemoval(client: unknown): client is { auth: { set: (o: { providerID: string; auth: unknown }) => Promise<unknown> } } {
  const c = client as { auth?: { set?: unknown } };
  return typeof c?.auth?.set === "function";
}

Try / catch

try {
  await store.removeProviderCredentials(providerId);
} catch (e) {
  if (e instanceof Error && e.message.includes("removal")) {
    showToast("Credential removal not supported by this server; clear it manually in opencode auth storage.");
  } else throw e;
}

Prevention

When it happens

Trigger: Calling removeProviderAuthCredentials (via the store's provider-credential removal action) when options.client() returns a client whose auth object has no `remove` function, whose client has no `delete` method, and whose auth object has no `set` function.

Common situations: Connecting to an old opencode server or a mock/test client that predates the auth remove/set API; a stale pinned SDK client version; a custom client adapter that implements auth login but not logout; pointing the app at an incompatible/self-hosted server build.

Related errors


AI-assisted analysis of different-ai/openwork@2b7df46e8a (2026-09-01). Data as JSON: /api/errors/4d4f613691564ab5. Report an issue: GitHub.