Molunerfinn/PicGo · error
result.error (dynamic message propagated from RPC failure)
Error message
result.error (dynamic message propagated from RPC failure)
What it means
fetchPicGoCloudConfigSyncState throws Error(result.error) when the PICGO_CLOUD_CONFIG_SYNC_GET_STATE RPC via cloudAdapter.getConfigSyncState() returns success:false. The config-sync state query then enters error state with the main-process-provided message. This gate is used to keep the sync UI consistent with server state.
Source
Thrown at src/renderer/queries/picgo-cloud-config-sync.ts:14
import { useQuery } from '@tanstack/react-query'
import type { IPicGoCloudConfigSyncState } from '#/types/cloudConfigSync'
import { cloudAdapter } from '@/adapters/cloud'
import { rendererQueryClient } from './query-client'
import { usePicGoCloudUserInfo } from './picgo-cloud'
export const PicGoCloudConfigSyncQueryKeys = {
state: ['picgo-cloud', 'config-sync-state'] as const
}
async function fetchPicGoCloudConfigSyncState (): Promise<IPicGoCloudConfigSyncState> {
const result = await cloudAdapter.getConfigSyncState()
if (!result.success) {
throw new Error(result.error)
}
return result.data
}
export function useCloudConfigSyncStateQuery () {
const { userInfo } = usePicGoCloudUserInfo()
return useQuery({
queryKey: PicGoCloudConfigSyncQueryKeys.state,
queryFn: fetchPicGoCloudConfigSyncState,
enabled: !!userInfo,
refetchOnWindowFocus: true
})
}
export function setCloudConfigSyncStateQueryData (state: IPicGoCloudConfigSyncState) {
rendererQueryClient.setQueryData(PicGoCloudConfigSyncQueryKeys.state, state)
}
View on GitHub (pinned to 07ec7068a5)
Solutions
- Confirm userInfo exists — the query hook derives enabled state from usePicGoCloudUserInfo; wait for login before rendering the sync UI.
- Inspect query.error.message; if auth-related, re-login and invalidate ['picgo-cloud','config-sync-state'].
- For network failures, refetch after reconnect.
- Guard the UI with the enabled option so the query does not run for logged-out users.
Example fix
// before
export function useCloudConfigSyncStateQuery () {
const { userInfo } = usePicGoCloudUserInfo()
...
}
// after
export function useCloudConfigSyncStateQuery () {
const { userInfo } = usePicGoCloudUserInfo()
return useQuery({
queryKey: PicGoCloudConfigSyncQueryKeys.state,
queryFn: fetchPicGoCloudConfigSyncState,
enabled: !!userInfo
})
} Defensive patterns
Strategy: validation
Validate before calling
const { userInfo } = usePicGoCloudUserInfo()
const query = useCloudConfigSyncStateQuery()
// Only call sync actions / trust state when:
if (!userInfo || query.isError) return Type guard
function isConfigSyncState(r: unknown): r is IPicGoCloudConfigSyncState {
return typeof r === 'object' && r !== null && 'phase' in r
} Try / catch
try {
const state = await cloudAdapter.getConfigSyncState()
if (!state.success) {
toast.error(resolveCloudErrorMessage(i18n.t, undefined, undefined, state.error || 'Sync state unavailable'))
return
}
} catch (e) {
toast.error(e instanceof Error ? e.message : 'Sync state unavailable')
} Prevention
- Set enabled: !!userInfo on the query so it never fires for anonymous users.
- Disable config-sync UI controls while query.isError is true.
- Re-login and invalidate the query when the error message indicates auth failure.
- Treat sync state as unavailable (not as 'in sync') on error.
When it happens
Trigger: The config sync state RPC fails: unauthenticated user (the query is enabled based on userInfo from usePicGoCloudUserInfo), expired token, picgo-hub connectivity failure, or handler-side exception serialized into result.error.
Common situations: Mounting the config sync settings panel before login completes; token expiry mid-session; transient network loss; querying while a sync run is in an inconsistent server state.
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)
- Failed to refresh plugin config schema
AI-assisted analysis of Molunerfinn/PicGo@07ec7068a5 (2026-08-30).
Data as JSON: /api/errors/8683c9986fb265cb.
Report an issue: GitHub.