{"record":{"id":"1c60b3847ecfc340","repo":"infiniflow/ragflow","slug":"failed-to-update-memory","errorCode":null,"errorMessage":"Failed to update memory","messagePattern":"Failed to update memory","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"web/src/pages/memories/hooks.ts","lineNumber":211,"sourceCode":"  );\n\n  return { data, isError, deleteMemory };\n};\n\nexport const useUpdateMemory = () => {\n  const { t } = useTranslation();\n  const queryClient = useQueryClient();\n  const {\n    data,\n    isError,\n    mutateAsync: updateMemoryMutation,\n  } = useMutation<any, Error, IMemoryAppDetailProps>({\n    mutationKey: ['updateMemory'],\n    mutationFn: async (formData) => {\n      const param = omit(formData, ['id']);\n      const { data: response } = await updateMemoryById(formData.id, param);\n      if (response.code !== 0) {\n        throw new Error(response.message || 'Failed to update memory');\n      }\n\n      return response.data;\n    },\n    onSuccess: (data, variables) => {\n      message.success(t('message.updated'));\n      queryClient.invalidateQueries({\n        queryKey: ['memoryDetail', variables.id],\n      });\n      queryClient.invalidateQueries({\n        queryKey: [MemoryApiAction.FetchMemoryDetail],\n      });\n    },\n  });\n\n  const updateMemory = useCallback(\n    (formData: IMemoryAppDetailProps) => {\n      return updateMemoryMutation(formData);","sourceCodeStart":193,"sourceCodeEnd":229,"githubUrl":"https://github.com/infiniflow/ragflow/blob/554fb1133ac3861732235ad9c377eb5e0a770665/web/src/pages/memories/hooks.ts#L193-L229","documentation":"Terminal fallback in get_google_creds: neither the OAuth branch produced oauth_creds nor did the service-account branch produce service_creds. The credential dict matched no recognized structure (no token key, no service-account key, or both branches failed silently earlier), so the app cannot guess how to authenticate.","triggerScenarios":"Credential payload contains unrelated keys (e.g. only a username/password pair), the token key present but empty string, or both branches raising before assignment in an environment that swallows the earlier errors.","commonSituations":"Credential written for a different connector type, fields stripped by a sanitizer, dict built with None values from an empty form.","solutions":["Inspect the credential dict keys and compare against what get_google_creds expects: token-dict key (with client_id/secret/refresh_token) or service-account key","Rebuild the credential from a known-good source: OAuth flow output or GCP-downloaded service-account JSON","Check for earlier swallowed exceptions in the OAuth/service-account branches — this error is often a downstream symptom"],"exampleFix":"# before\ncredentials = {\"username\": \"x\", \"password\": \"y\"}\nget_google_creds(credentials, source)  # unknown structure\n\n# after\ncredentials = {\n    \"google_drive_token_dict\": '{\"client_id\": \"...\", \"client_secret\": \"...\", \"refresh_token\": \"...\"}',\n    \"primary_admin_email\": \"admin@acme.com\",\n}\nget_google_creds(credentials, source)","handlingStrategy":"validation","validationCode":"def recognized_google_credential(creds: dict) -> str | None:\n    if DB_CREDENTIALS_DICT_TOKEN_KEY in creds and creds[DB_CREDENTIALS_DICT_TOKEN_KEY]:\n        return \"oauth\"\n    if DB_CREDENTIALS_DICT_SERVICE_ACCOUNT_KEY in creds and creds[DB_CREDENTIALS_DICT_SERVICE_ACCOUNT_KEY]:\n        return \"service_account\"\n    return None","typeGuard":null,"tryCatchPattern":"try:\n    creds_obj, new_dict = get_google_creds(credentials, source)\nexcept PermissionError as e:\n    if \"unknown credential structure\" in str(e):\n        raise ConfigurationError(\n            \"Credential needs either an OAuth token blob or a service-account key; \"\n            f\"found keys: {sorted(credentials)}\"\n        ) from e","preventionTips":["Lint credentials against the expected key schema before saving","Don't reuse payloads across connector types","Log which structure was detected at load time for faster diagnosis"],"tags":["google-drive","credentials","configuration","authentication"],"backgroundTag":null,"analyzedSha":"554fb1133ac3861732235ad9c377eb5e0a770665","analyzedAt":"2026-08-15T09:20:16.380Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}