Molunerfinn/PicGo · error
result.error (dynamic message propagated from RPC failure)
Error message
result.error (dynamic message propagated from RPC failure)
What it means
fetchPicGoCloudUserInfo throws Error(result.error) when cloudAdapter.getUserInfo({ refresh: true }) returns success:false, forcing a server-side refresh of the PicGo Cloud user profile through the PICGO_CLOUD_GET_USER_INFO RPC. Because many other queries depend on this userInfo, a failure here cascades to dependent hooks like usePicGoCloudUserInfo and useCloudConfigSyncStateQuery.
Source
Thrown at src/renderer/queries/picgo-cloud.ts:13
import { useQuery } from '@tanstack/react-query'
import { UserPlanLevel, type IPicGoCloudUserInfo } from '#/types/cloud'
import { cloudAdapter } from '@/adapters/cloud'
import { rendererQueryClient } from './query-client'
export const PicGoCloudQueryKeys = {
userInfo: ['picgo-cloud', 'user-info'] as const
}
async function fetchPicGoCloudUserInfo (): Promise<IPicGoCloudUserInfo | null> {
const result = await cloudAdapter.getUserInfo({ refresh: true })
if (!result.success) {
throw new Error(result.error)
}
return result.data
}
export function usePicGoCloudUserInfoQuery () {
return useQuery({
queryKey: PicGoCloudQueryKeys.userInfo,
queryFn: fetchPicGoCloudUserInfo,
refetchOnWindowFocus: true
})
}
export function usePicGoCloudUserInfo () {
const query = usePicGoCloudUserInfoQuery()
const userInfo = query.data
return {
...query,View on GitHub (pinned to 07ec7068a5)
Solutions
- Inspect query.error.message; if it indicates auth failure, run cloudAdapter.login() to establish a fresh session.
- On success of re-login, call invalidatePicGoCloudUserInfoQuery() to retry the fetch.
- For transient network errors, rely on refetchOnWindowFocus or manual invalidate.
- Treat persistent failure as logged-out state in the UI rather than showing stale profile data.
- Add a fallback message if result.error may be undefined (new Error(result.error || '...')) to avoid empty error text.
Example fix
// before
if (!result.success) {
throw new Error(result.error)
}
// after
if (!result.success) {
throw new Error(result.error || 'Failed to fetch PicGo Cloud user info')
} Defensive patterns
Strategy: retry
Validate before calling
const token = await getStoredCloudToken()
if (!token) {
// Skip refresh; treat as logged out rather than letting the RPC fail
setPicGoCloudUserInfoQueryData(null)
} Type guard
function isUserInfoSuccess(r: { success: boolean, data?: IPicGoCloudUserInfo | null, error?: string }): r is { success: true, data: IPicGoCloudUserInfo | null } {
return r.success === true
} Try / catch
try {
await invalidatePicGoCloudUserInfoQuery()
const { error } = usePicGoCloudUserInfo()
if (error) {
await cloudAdapter.login() // re-auth on failure, then invalidate again
await invalidatePicGoCloudUserInfoQuery()
}
} catch (e) {
toast.error(e instanceof Error ? e.message : 'Cloud login required')
} Prevention
- Configure retry: 1-2 attempts with backoff for this root query since many queries depend on it.
- On auth-flavored errors, run the login flow instead of retrying blindly.
- Invalidate downstream queries (usage, billing, config-sync) after userInfo recovers.
- Treat persistent userInfo failure as logged-out state in the UI.
When it happens
Trigger: User info RPC fails with refresh:true: token expired or revoked, picgo-hub unreachable, account frozen/deleted server-side, or handler exception serialized into result.error.
Common situations: App start with a stale token (refetchOnWindowFocus triggers refresh); password changed on another device; server maintenance window; offline launch.
Related errors
- result.error (dynamic message propagated from RPC failure)
- result.error (dynamic message propagated from RPC failure)
- result.error (dynamic message propagated from RPC failure)
- result.error (dynamic message propagated from RPC failure)
- Install plugin failed
AI-assisted analysis of Molunerfinn/PicGo@07ec7068a5 (2026-08-30).
Data as JSON: /api/errors/e967647a7ae62cee.
Report an issue: GitHub.