{"record":{"id":"783745c8c99f0f60","repo":"toeverything/AFFiNE","slug":"calendar-provider-request-error-783745","errorCode":"calendar_provider_request_error","errorMessage":"Calendar provider request error, status: ${status}, message: ${message}","messagePattern":"Calendar provider request error, status: (.+?), message: (.+?)","errorType":"exception","errorClass":"CalendarProviderRequestError","httpStatus":500,"severity":"error","filePath":"packages/backend/server/src/plugins/calendar/providers/def.ts","lineNumber":179,"sourceCode":"  protected withTimeout(signal?: AbortSignal | null) {\n    const timeoutMs = this.requestTimeoutMs;\n    if (!timeoutMs) return signal;\n\n    const timeoutSignal = AbortSignal.timeout(timeoutMs);\n    if (!signal) return timeoutSignal;\n\n    return AbortSignal.any([signal, timeoutSignal]);\n  }\n\n  protected async fetchJson<T>(url: string, init?: RequestInit) {\n    const response = await fetch(url, {\n      ...init,\n      signal: this.withTimeout(init?.signal),\n      headers: { ...init?.headers, Accept: 'application/json' },\n    });\n    const body = await response.text();\n    if (!response.ok) {\n      throw new CalendarProviderRequestError({\n        status: response.status,\n        message: body,\n      });\n    }\n    if (!body) {\n      return {} as T;\n    }\n    return JSON.parse(body) as T;\n  }\n\n  protected postFormJson<T>(\n    url: string,\n    body: string,\n    options?: { headers?: Record<string, string> }\n  ) {\n    return this.fetchJson<T>(url, {\n      method: 'POST',\n      body,","sourceCodeStart":161,"sourceCodeEnd":197,"githubUrl":"https://github.com/toeverything/AFFiNE/blob/b4c8548c09da21b2898443559a5b846f0ccf5dd8/packages/backend/server/src/plugins/calendar/providers/def.ts#L161-L197","documentation":"fetchJson wraps every provider HTTP call and throws CalendarProviderRequestError with the upstream status/message when the response is not ok, normalizing remote calendar API failures (including timeouts via the timeout signal) into one error type.","triggerScenarios":"Thrown at packages/backend/server/src/plugins/calendar/providers/def.ts:179 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the status code and message returned by the calendar provider to find the root cause.","Confirm the provider account is still connected and its credentials or tokens are valid.","Retry after re-authenticating the calendar account; escalate to the provider if the error persists."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b4c8548c09da21b2898443559a5b846f0ccf5dd8","analyzedAt":"2026-08-18T21:16:52.546Z","contentChangedAt":"2026-08-18T21:16:52.546Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}