Molunerfinn/PicGo · warning

TIPS_UPLOADER_CONFIG_CANNOT_DELETE_LAST

Error message

TIPS_UPLOADER_CONFIG_CANNOT_DELETE_LAST

What it means

The DELETE_PICBED_CONFIG RPC route refuses to delete when the uploader type has only one configuration left, throwing TIPS_UPLOADER_CONFIG_CANNOT_DELETE_LAST. At least one config per uploader type must always exist so an active uploader config remains resolvable. The message is an i18n key rendered for the user.

Source

Thrown at src/main/events/rpc/routes/config.ts:58

  .add(IRPCActionType.GET_PICBED_CONFIG_LIST, async (args) => {
    try {
      const [type] = args as IGetUploaderConfigListArgs
      const configList = picgo.uploaderConfig.getConfigList(type)
      const activeConfig = picgo.uploaderConfig.getActiveConfig(type)
      return ok({
        configList,
        defaultId: activeConfig?._id ?? ''
      })
    } catch (e) {
      return fail(e)
    }
  })
  .add(IRPCActionType.DELETE_PICBED_CONFIG, async (args) => {
    try {
      const [type, configName] = args as IDeleteUploaderConfigArgs
      const existing = picgo.uploaderConfig.getConfigList(type)
      if (existing.length <= 1) {
        throw new Error(T('TIPS_UPLOADER_CONFIG_CANNOT_DELETE_LAST'))
      }
      picgo.uploaderConfig.remove(type, configName)
      const configList = picgo.uploaderConfig.getConfigList(type)
      const activeConfig = picgo.uploaderConfig.getActiveConfig(type)
      notifyAppConfigUpdated()
      return ok({
        configList,
        defaultId: activeConfig?._id ?? ''
      })
    } catch (e) {
      return fail(e)
    }
  })
  .add(IRPCActionType.COPY_UPLOADER_CONFIG, async (args) => {
    try {
      const [type, configName, newConfigName] = args as ICopyUploaderConfigArgs
      picgo.uploaderConfig.copy(type, configName, newConfigName)
      const configList = picgo.uploaderConfig.getConfigList(type)

View on GitHub (pinned to 07ec7068a5)

Solutions

  1. Create a second config for the type before deleting the one you want removed
  2. Switch to a different uploader type entirely instead of deleting the last config
  3. In the UI, disable/hide the delete action when configList.length <= 1
  4. If you truly need an empty list, clear config via config editing rather than the delete API

Example fix

// before
await deleteUploaderConfig(type, 'only-config') // throws if it's the last one
// after
await addUploaderConfig(type, 'new-default')
await deleteUploaderConfig(type, 'only-config')
Defensive patterns

Strategy: validation

Validate before calling

const list = await getUploaderConfigList(type)
if (list.length <= 1) {
  throw new Error('Cannot delete the last config for ' + type)
}
await deleteUploaderConfig(type, configName)

Try / catch

try {
  await deleteUploaderConfig(type, configName)
} catch (e) {
  if (e.message.includes('CANNOT_DELETE_LAST')) {
    notify('Create another config before deleting this one')
  } else throw e
}

Prevention

When it happens

Trigger: Calling DELETE_PICBED_CONFIG with [type, configName] where picgo.uploaderConfig.getConfigList(type).length <= 1 — i.e. deleting the only config for that uploader type.

Common situations: User repeatedly deletes uploader profiles and reaches the last one; UI delete button not disabled when only one entry remains; batch cleanup scripts removing all configs of a type.

Related errors


AI-assisted analysis of Molunerfinn/PicGo@07ec7068a5 (2026-08-30). Data as JSON: /api/errors/1e39376d73249235. Report an issue: GitHub.