Molunerfinn/PicGo · error
Failed to save provider config
Error message
Failed to save provider config
What it means
saveProviderConfig sends IRPCActionType.UPDATE_UPLOADER_CONFIG and throws in two cases: the RPC result reports failure, or result.data !== true (the handler did not confirm the write). The main handler (src/main/events/rpc/routes/config.ts:97) throws TIPS_UPLOADER_CONFIG_NAME_EMPTY when updating (configId set) without _configName, and TIPS_UPLOADER_CONFIG_NOT_FOUND when the configId does not match any existing config, then renames and creates/updates via picgo.uploaderConfig.
Source
Thrown at src/renderer/adapters/providers.ts:55
const result = await invokeRPC<IUploaderConfigItem>(IRPCActionType.DELETE_PICBED_CONFIG, type, configName)
if (!result.success) {
throw new Error(result.error || 'Failed to delete provider config')
}
return result.data
},
async copyProviderConfig (type: string, configName: string, newConfigName: string) {
const result = await invokeRPC<IUploaderConfigItem>(IRPCActionType.COPY_UPLOADER_CONFIG, type, configName, newConfigName)
if (!result.success) {
throw new Error(result.error || 'Failed to copy provider config')
}
return result.data
},
async saveProviderConfig (type: string, configId: string, values: IStringKeyMap) {
const result = await invokeRPC<boolean>(IRPCActionType.UPDATE_UPLOADER_CONFIG, type, configId, values)
if (!result.success) {
throw new Error(result.error || 'Failed to save provider config')
}
if (result.data !== true) {
throw new Error('Failed to save provider config')
}
},
getProviderSchema (type: string): Promise<ProviderSchemaResult> {
return new Promise((resolve, reject) => {
const cleanup = ipc.once(GET_PICBED_CONFIG, (config: IPicGoPluginConfig[], name: string) => {
resolve({ config, name })
})
try {
sendToMain(GET_PICBED_CONFIG, type)
} catch (error) {
cleanup()
reject(error)
}View on GitHub (pinned to 07ec7068a5)
Solutions
- Ensure values includes a non-empty _configName string when configId is provided
- Refresh the config list and verify the configId still exists before saving
- Check result.error / main-process logs for TIPS_UPLOADER_CONFIG_NAME_EMPTY or TIPS_UPLOADER_CONFIG_NOT_FOUND
- If the config was deleted elsewhere, recreate it (create flow, empty configId) instead of updating
- Verify the PicGo config file is writable and not corrupted
Example fix
// before
await saveProviderConfig(type, configId, values)
// after
if (configId && !values._configName) throw new Error('config name is required when updating')
const { configList } = await getProviderConfigList(type)
if (!configList.some(c => c._id === configId)) throw new Error('config no longer exists')
await saveProviderConfig(type, configId, values) Defensive patterns
Strategy: validation
Validate before calling
if (configId && (typeof values._configName !== 'string' || !values._configName.trim())) {
throw new Error('config name is required when updating an existing config')
} Type guard
function isSavable(configId: string, values: IStringKeyMap): boolean {
return !configId || (typeof values._configName === 'string' && values._configName.trim().length > 0)
} Try / catch
try {
await saveProviderConfig(type, configId, values)
} catch (e) {
logger.error('[picbed] save failed', e)
showNotification((e as Error).message || $T('TIPS_SAVE_CONFIG_FAILED'))
// keep the form open so the user does not lose entered values
} Prevention
- Always attach _configName to the values object when editing an existing config (configId set)
- Require non-empty config names in the form before enabling Save
- Refresh the config list before save to confirm the configId still exists
- Keep the form data intact on failure and let the user correct and retry
- Verify the config file location is writable (no permission/AV lock)
When it happens
Trigger: Calling saveProviderConfig(type, configId, values) where values._configName is missing/empty while updating an existing config; configId refers to a config deleted in another window; main process write to the PicGo config fails so success=false or data!==true.
Common situations: Saving a renamed config whose name field was cleared in the form; concurrent deletion making the configId stale; corrupted config file preventing createOrUpdate; renderer form submitting values without _configName attached.
Related errors
- Failed to delete provider config
- Failed to load provider configs
- Failed to select provider config
- Failed to copy provider config
- TIPS_UPLOADER_CONFIG_NAME_EMPTY
AI-assisted analysis of Molunerfinn/PicGo@07ec7068a5 (2026-08-30).
Data as JSON: /api/errors/49bd42e1a336d529.
Report an issue: GitHub.