Molunerfinn/PicGo · error
Failed to delete provider config
Error message
Failed to delete provider config
What it means
deleteProviderConfig sends IRPCActionType.DELETE_PICBED_CONFIG and throws when the RPC reports failure. The main handler (src/main/events/rpc/routes/config.ts:53) refuses to delete when only one config remains (TIPS_UPLOADER_CONFIG_CANNOT_DELETE_LAST) and picgo.uploaderConfig.remove(type, configName) can also throw if the named config does not exist. This guard prevents leaving a picbed type with zero configs.
Source
Thrown at src/renderer/adapters/providers.ts:39
const result = await invokeRPC<IUploaderConfigItem>(IRPCActionType.GET_PICBED_CONFIG_LIST, type)
if (!result.success) {
throw new Error(result.error || 'Failed to load provider configs')
}
return result.data
},
async selectProviderConfig (type: string, configName: string) {
const result = await invokeRPC<string>(IRPCActionType.SELECT_UPLOADER, type, configName)
if (!result.success) {
throw new Error(result.error || 'Failed to select provider config')
}
return result.data
},
async deleteProviderConfig (type: string, configName: string) {
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')
}
View on GitHub (pinned to 07ec7068a5)
Solutions
- Create a second config for that uploader type before deleting the last one (the main process enforces at least one config)
- Refresh the config list and confirm the configName still exists before calling delete
- Read result.error for the specific main-process message (e.g. cannot delete last config)
- Retry after resyncing the settings window if the failure came from stale renderer state
Example fix
// before
await deleteProviderConfig(type, name)
// after
const { configList } = await getProviderConfigList(type)
if (configList.length > 1) await deleteProviderConfig(type, name) Defensive patterns
Strategy: validation
Validate before calling
const { configList } = await getProviderConfigList(type)
if (configList.length <= 1) throw new Error('cannot delete the last config of this uploader')
if (!configList.some(c => c._configName === configName)) throw new Error('config not found') Type guard
function isDeletable(list: IUploaderConfigItem[], name: string): boolean { return list.length > 1 && list.some(c => c._configName === name) } Try / catch
try {
await deleteProviderConfig(type, configName)
} catch (e) {
// main enforces keeping the last config; surface its localized message
const msg = (e as Error).message
showNotification(msg || $T('TIPS_DELETE_CONFIG_FAILED'))
await refreshConfigList(type)
} Prevention
- Disable the delete button in UI when only one config remains
- Refresh the list before each delete to avoid stale names
- Show a confirmation dialog before deleting
- Never script deletion down to the final config
When it happens
Trigger: Deleting the last remaining config of an uploader type; deleting a configName that was already removed or renamed elsewhere; passing an unknown type.
Common situations: User tries to remove their only configured uploader; two settings windows operate on the same config simultaneously; stale UI list after a rename; programmatic cleanup scripts hitting the final config.
Related errors
- Failed to save 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/7cd7880aadbc45d9.
Report an issue: GitHub.