{"record":{"id":"46e68b37380bab81","repo":"infiniflow/ragflow","slug":"failed-to-fetch-memory-list","errorCode":null,"errorMessage":"Failed to fetch memory list","messagePattern":"Failed to fetch memory list","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"web/src/pages/memories/hooks.ts","lineNumber":98,"sourceCode":"  >({\n    queryKey: [\n      'memoryList',\n      {\n        debouncedSearchString,\n        ...pagination,\n      },\n      filterValue,\n    ],\n    queryFn: async () => {\n      const { data: response } = await memoryService.getMemoryList(\n        {\n          params: requestParams,\n          data: { memory_type: memoryType },\n        },\n        true,\n      );\n      if (response.code !== 0) {\n        throw new Error(response.message || 'Failed to fetch memory list');\n      }\n      console.log(response);\n      return response;\n    },\n  });\n\n  // const setMemoryListParams = (newParams: MemoryListParams) => {\n  //   setMemoryParams((prevParams) => ({\n  //     ...prevParams,\n  //     ...newParams,\n  //   }));\n  // };\n\n  return {\n    data,\n    isLoading,\n    isError,\n    pagination,","sourceCodeStart":80,"sourceCodeEnd":116,"githubUrl":"https://github.com/infiniflow/ragflow/blob/554fb1133ac3861732235ad9c377eb5e0a770665/web/src/pages/memories/hooks.ts#L80-L116","documentation":"Non-HttpError exception during validation whose string form contains MISSING_SCOPES_ERROR_STR (Google's 'Request had insufficient authentication scopes' message). Token authenticates but was minted with a narrower scope than the call needs; raised as InsufficientPermissionsError.","triggerScenarios":"google.auth exceptions carrying the insufficient-scopes reason (raised during credential refresh or the transport layer rather than an HTTP response), tokens created via gcloud auth application-default login (limited scopes), or incremental-consent tokens missing admin-directory scope.","commonSituations":"Reusing ADC or CLI-generated tokens instead of the connector's OAuth flow, Google changing default scope sets, user granting only some requested scopes in a subset-consent deployment.","solutions":["Regenerate the token through the connector's own OAuth flow so all requested scopes are consented","Set GOOGLE_OAUTH_SCOPE_OVERRIDE to a scope list your Workspace admin permits, then re-run the flow","For service accounts, ensure domain-wide delegation includes the exact scopes in the error body"],"exampleFix":"# before\ncreds = GoogleCredentials.get_application_default()  # narrow scopes\n\n# after: explicit full scope set\nfrom google_auth_oauthlib.flow import InstalledAppFlow\nflow = InstalledAppFlow.from_client_config(cfg, scopes=[\n    \"https://www.googleapis.com/auth/drive.readonly.metadata\",\n    \"https://www.googleapis.com/auth/admin.directory.user.readonly\",\n])\ncreds = flow.run_local_server()","handlingStrategy":"validation","validationCode":"MISSING_SCOPES = \"insufficient authentication scopes\"\n\ndef error_mentions_scopes(exc: Exception) -> bool:\n    return MISSING_SCOPES in str(exc)","typeGuard":"REQUIRED = {\n    \"https://www.googleapis.com/auth/drive.readonly.metadata\",\n    \"https://www.googleapis.com/auth/admin.directory.user.readonly\",\n}\n\ndef creds_have_all_scopes(creds) -> bool:\n    return REQUIRED <= set(getattr(creds, \"scopes\", None) or [])","tryCatchPattern":"from common.data_source.exceptions import InsufficientPermissionsError\n\ntry:\n    connector.validate_connector_settings()\nexcept InsufficientPermissionsError as e:\n    if \"missing required scopes\" in str(e):\n        connector.load_credentials(reissue_oauth_with_full_scope_consent())\n        connector.validate_connector_settings()","preventionTips":["Mint tokens only via the connector's own flow, never gcloud ADC","Use GOOGLE_OAUTH_SCOPE_OVERRIDE when Workspace policy limits grantable scopes, and record the reduced set","On scope-list changes, version-bump tokens: force re-consent for all users"],"tags":["google-drive","scopes","oauth","permissions"],"backgroundTag":null,"analyzedSha":"554fb1133ac3861732235ad9c377eb5e0a770665","analyzedAt":"2026-08-15T09:20:16.380Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}