Molunerfinn/PicGo · error
Failed to copy provider config
Error message
Failed to copy provider config
What it means
copyProviderConfig sends IRPCActionType.COPY_UPLOADER_CONFIG to duplicate an existing uploader config under a new name and throws when the RPC fails. The main handler (src/main/events/rpc/routes/config.ts:72) calls picgo.uploaderConfig.copy(type, configName, newConfigName), which throws when the source config does not exist or the target name already exists. The renderer wraps that failure into this generic error.
Solutions
- Pick a newConfigName that does not already exist in the type's config list
- Refresh the config list and verify the source configName still exists before copying
- Trim/normalize the new name to avoid whitespace-only collisions
- Inspect result.error for the main-process message (name exists / source not found)
Example fix
// before
await copyProviderConfig(type, src, newName)
// after
const { configList } = await getProviderConfigList(type)
if (!configList.some(c => c._configName === newName)) await copyProviderConfig(type, src, newName.trim()) Defensive patterns
Strategy: validation
Validate before calling
const { configList } = await getProviderConfigList(type)
if (!configList.some(c => c._configName === configName)) throw new Error('source config not found')
if (configList.some(c => c._configName === newConfigName)) throw new Error('target name already exists') Type guard
function canCopy(list: IUploaderConfigItem[], src: string, dest: string): boolean { return list.some(c => c._configName === src) && !list.some(c => c._configName === dest) } Try / catch
try {
await copyProviderConfig(type, configName, newConfigName)
} catch (e) {
showNotification((e as Error).message || $T('TIPS_COPY_CONFIG_FAILED'))
await refreshConfigList(type)
} Prevention
- Auto-generate unique names (e.g. append '-copy', '-copy-2') instead of a fixed suffix
- Trim and normalize names before comparing
- Reject empty or duplicate names in the input form
- Refresh the list before copy operations
When it happens
Trigger: Calling providersAdapter.copyProviderConfig(type, configName, newConfigName) with a source configName not in the list, or a newConfigName that duplicates an existing config, or an unknown uploader type.
Common situations: User copies a config twice and the second attempt collides on the duplicate name; renaming elsewhere between listing and copying; leading/trailing whitespace making names appear unique but collide or miss.
Related errors
- Failed to delete provider config
- Failed to load provider configs
- Failed to save provider config
- Failed to select provider config
- Failed to change current uploader
AI-assisted analysis of Molunerfinn/PicGo@07ec7068a5 (2026-08-30).
Data as JSON: /api/errors/568651c68966454b.
Report an issue: GitHub.
Appendix: source
Thrown at src/renderer/adapters/providers.ts:47
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')
}
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 })View on GitHub (pinned to 07ec7068a5)