{"record":{"id":"f7bc84db1f4c8b3e","repo":"toeverything/AFFiNE","slug":"caldav-provider-unavailable","errorCode":"caldav_provider_unavailable","errorMessage":"GraphQL bad request, code: caldav_provider_unavailable, CalDAV provider is not configured.","messagePattern":"GraphQL bad request, code: caldav_provider_unavailable, CalDAV provider is not configured\\.","errorType":"exception","errorClass":"GraphqlBadRequest","httpStatus":400,"severity":"error","filePath":"packages/backend/server/src/plugins/calendar/service.ts","lineNumber":215,"sourceCode":"      throw new GraphqlBadRequest({\n        code: 'caldav_disabled',\n        message: 'CalDAV integration is not enabled.',\n      });\n    }\n\n    const preset = caldavConfig.providers.find(\n      provider => provider.id === params.input.providerPresetId\n    );\n    if (!preset) {\n      throw new GraphqlBadRequest({\n        code: 'caldav_provider_not_found',\n        message: 'CalDAV provider is not available.',\n      });\n    }\n\n    const provider = this.requireProvider(CalendarProviderName.CalDAV);\n    if (!('discoverAccount' in provider)) {\n      throw new GraphqlBadRequest({\n        code: 'caldav_provider_unavailable',\n        message: 'CalDAV provider is not configured.',\n      });\n    }\n\n    const discovery = await (\n      provider as CalendarProvider & {\n        discoverAccount: (input: {\n          preset: CalendarCalDAVProviderPreset;\n          username: string;\n          password: string;\n        }) => Promise<{\n          providerAccountId: string;\n          serverUrl: string;\n          principalUrl: string;\n          calendarHomeUrl: string;\n          authType?: string | null;\n        }>;","sourceCodeStart":197,"sourceCodeEnd":233,"githubUrl":"https://github.com/toeverything/AFFiNE/blob/591f874dad30887a80143a061a44bd3ca7ee3299/packages/backend/server/src/plugins/calendar/service.ts#L197-L233","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Upgrade the backend to a version that ships the CalDAV provider with discoverAccount support.","Check server startup logs that the CalDAV provider module registered successfully under CalendarProviderName.CalDAV.","Verify the build flags / edition of the server actually includes CalDAV discovery; if not, disable the CalDAV UI until it does.","If you control the provider registration, make sure the registered class exposes discoverAccount(preset, username, password)."],"exampleFix":"null","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await discoverCalDAVAccount(input);\n} catch (e) {\n  if (e?.extensions?.code === 'caldav_provider_unavailable') {\n    hideCalDavDiscoveryUI(); // server build lacks this capability\n  } else throw e;\n}","preventionTips":["Gate CalDAV discovery UI on a server capability/version check before offering the flow.","Keep server and client versions aligned when using CalDAV features.","Monitor provider registration logs at startup so a missing module is caught at deploy time."],"tags":["caldav","calendar","provider-registry","graphql","feature-detection"],"backgroundTag":"provider-not-registered","analyzedSha":"591f874dad30887a80143a061a44bd3ca7ee3299","analyzedAt":"2026-08-18T21:16:52.546Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}