toeverything/AFFiNE · error · GraphqlBadRequest

caldav_provider_unavailable

caldav_provider_unavailable

Error message

GraphQL bad request, code: caldav_provider_unavailable, CalDAV provider is not configured.

What it means

Thrown when the requested CalDAV preset exists in config, but the calendar provider registry returns a CalDAV provider instance that does not implement discoverAccount. The service feature-detects the method ('discoverAccount' in provider) because the registered CalDAV provider may be a stub or an older build without discovery support. This is a server-side capability gap, not a user input error.

Source

Thrown at packages/backend/server/src/plugins/calendar/service.ts:215

      throw new GraphqlBadRequest({
        code: 'caldav_disabled',
        message: 'CalDAV integration is not enabled.',
      });
    }

    const preset = caldavConfig.providers.find(
      provider => provider.id === params.input.providerPresetId
    );
    if (!preset) {
      throw new GraphqlBadRequest({
        code: 'caldav_provider_not_found',
        message: 'CalDAV provider is not available.',
      });
    }

    const provider = this.requireProvider(CalendarProviderName.CalDAV);
    if (!('discoverAccount' in provider)) {
      throw new GraphqlBadRequest({
        code: 'caldav_provider_unavailable',
        message: 'CalDAV provider is not configured.',
      });
    }

    const discovery = await (
      provider as CalendarProvider & {
        discoverAccount: (input: {
          preset: CalendarCalDAVProviderPreset;
          username: string;
          password: string;
        }) => Promise<{
          providerAccountId: string;
          serverUrl: string;
          principalUrl: string;
          calendarHomeUrl: string;
          authType?: string | null;
        }>;

View on GitHub (pinned to 591f874dad)

Solutions

  1. Upgrade the backend to a version that ships the CalDAV provider with discoverAccount support.
  2. Check server startup logs that the CalDAV provider module registered successfully under CalendarProviderName.CalDAV.
  3. Verify the build flags / edition of the server actually includes CalDAV discovery; if not, disable the CalDAV UI until it does.
  4. If you control the provider registration, make sure the registered class exposes discoverAccount(preset, username, password).

Example fix

null
Defensive patterns

Strategy: try-catch

Try / catch

try {
  await discoverCalDAVAccount(input);
} catch (e) {
  if (e?.extensions?.code === 'caldav_provider_unavailable') {
    hideCalDavDiscoveryUI(); // server build lacks this capability
  } else throw e;
}

Prevention

When it happens

Trigger: Server build or plugin registration does not include the full CalDAV provider implementation (e.g. feature-flagged build, outdated server version, provider registered under a different name); the CalDAV provider was swapped for a minimal stub in self-hosted deployments; calling CalDAV account discovery right after upgrading the server but before the provider module is properly registered.

Common situations: Version skew between the API client (which advertises CalDAV discovery) and the deployed server (which lacks it); self-hosted builds that compile out optional calendar integrations; a provider registration that failed silently at startup.

Related errors


AI-assisted analysis of toeverything/AFFiNE@591f874dad (2026-08-18). Data as JSON: /api/errors/f7bc84db1f4c8b3e. Report an issue: GitHub.