{"record":{"id":"dab81afc793302b2","repo":"Molunerfinn/PicGo","slug":"tips-uploader-config-not-found","errorCode":null,"errorMessage":"TIPS_UPLOADER_CONFIG_NOT_FOUND","messagePattern":"TIPS_UPLOADER_CONFIG_NOT_FOUND","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/main/events/rpc/routes/config.ts","lineNumber":110,"sourceCode":"      return ok(activeConfig._id)\n    } catch (e) {\n      return fail(e)\n    }\n  })\n  .add(IRPCActionType.UPDATE_UPLOADER_CONFIG, async (args) => {\n    try {\n      const [type, configId, config] = args as IUpdateUploaderConfigArgs\n      const configName = typeof config._configName === 'string' ? config._configName : ''\n      if (configId && !configName) {\n        throw new Error(T('TIPS_UPLOADER_CONFIG_NAME_EMPTY'))\n      }\n\n      let oldConfigName = ''\n      if (configId) {\n        const configList = picgo.uploaderConfig.getConfigList(type)\n        const existConfig = configList.find(item => item._id === configId)\n        if (!existConfig) {\n          throw new Error(T('TIPS_UPLOADER_CONFIG_NOT_FOUND'))\n        }\n        oldConfigName = existConfig._configName\n      }\n\n      if (oldConfigName && oldConfigName !== configName) {\n        picgo.uploaderConfig.rename(type, oldConfigName, configName)\n      }\n      picgo.uploaderConfig.createOrUpdate(type, configName, config)\n      notifyAppConfigUpdated()\n      return ok(true)\n    } catch (e) {\n      return fail(e)\n    }\n  })\n\nexport {\n  configRouter\n}","sourceCodeStart":92,"sourceCodeEnd":128,"githubUrl":"https://github.com/Molunerfinn/PicGo/blob/07ec7068a5512344da093d49a8408fa63ba3421e/src/main/events/rpc/routes/config.ts#L92-L128","documentation":"When updating an uploader config by id, the route looks up the config in picgo.uploaderConfig.getConfigList(type) by _id. If no config with that _id exists, it throws TIPS_UPLOADER_CONFIG_NOT_FOUND. This means the target config was deleted, renamed at the storage layer, or the id was never valid for that type.","triggerScenarios":"Calling UPDATE_UPLOADER_CONFIG with a configId that doesn't match any item's _id in the type's config list — stale id after deletion, wrong type argument, or id from a different uploader.","commonSituations":"Two windows/tabs open and one deletes the config the other is editing; app restarted and config ids regenerated by a migration; hard-coded or copied ids in scripts; passing a picBed config id to an uploader route (or vice versa).","solutions":["Re-fetch getConfigList(type) and use a fresh _id before updating","Verify the `type` argument matches the type the config id belongs to","Refresh the settings UI so it edits an existing entry rather than a stale snapshot","If the config was deleted intentionally, recreate it instead of updating"],"exampleFix":"// before\nawait updateUploaderConfig('github', 'stale-id', cfg) // throws not found\n// after\nconst list = await getUploaderConfigList('github')\nconst target = list.find(c => c._configName === 'my-config')\nawait updateUploaderConfig('github', target._id, cfg)","handlingStrategy":"validation","validationCode":"const list = await getUploaderConfigList(type)\nconst exists = list.some(item => item._id === configId)\nif (!exists) throw new Error(`Config ${configId} not found for type ${type}`)","typeGuard":null,"tryCatchPattern":"try {\n  await updateUploaderConfig(type, configId, config)\n} catch (e) {\n  if (e.message.includes('CONFIG_NOT_FOUND')) {\n    const fresh = await getUploaderConfigList(type)\n    const target = fresh.find(c => c._configName === config._configName)\n    if (target) await updateUploaderConfig(type, target._id, config)\n  } else throw e\n}","preventionTips":["Re-fetch the config list immediately before updates; never cache _id across sessions","Verify the type argument matches the config's owner type","Handle concurrent deletion (refresh UI state when another window changes configs)"],"tags":["config","uploader","not-found","stale-data"],"backgroundTag":"entity-not-found","analyzedSha":"07ec7068a5512344da093d49a8408fa63ba3421e","analyzedAt":"2026-08-30T01:45:22.289Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}