{"record":{"id":"0c9455ee7c33f392","repo":"Molunerfinn/PicGo","slug":"tips-uploader-config-name-empty","errorCode":null,"errorMessage":"TIPS_UPLOADER_CONFIG_NAME_EMPTY","messagePattern":"TIPS_UPLOADER_CONFIG_NAME_EMPTY","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/main/events/rpc/routes/config.ts","lineNumber":102,"sourceCode":"      return fail(e)\n    }\n  })\n  .add(IRPCActionType.SELECT_UPLOADER, async (args) => {\n    try {\n      const [type, configName] = args as ISelectUploaderConfigArgs\n      const activeConfig = picgo.uploaderConfig.use(type, configName)\n      notifyAppConfigUpdated()\n      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)","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/Molunerfinn/PicGo/blob/07ec7068a5512344da093d49a8408fa63ba3421e/src/main/events/rpc/routes/config.ts#L84-L120","documentation":"The UPDATE_UPLOADER_CONFIG route requires a non-empty _configName when updating an existing config (configId present). If config._configName is not a non-empty string, it throws TIPS_UPLOADER_CONFIG_NAME_EMPTY. Names identify configs within an uploader type's list and are used for rename diffing.","triggerScenarios":"Calling UPDATE_UPLOADER_CONFIG with [type, configId, config] where configId is truthy but config._configName is undefined, null, or '' — e.g. a form that omits the name field on edit.","commonSituations":"Editing an existing uploader profile after the name input was cleared; client code that builds the config payload without copying _configName; older clients sending a payload shape missing the field after an API change.","solutions":["Include a non-empty _configName in the config payload when a configId is provided","In the edit form, prefill _configName from the existing config and validate it's non-empty before submitting","If the caller only wants to change settings without naming, pass through the existing config's _configName unchanged"],"exampleFix":"// before\nawait updateUploaderConfig(type, configId, { ...settings }) // _configName missing\n// after\nawait updateUploaderConfig(type, configId, { ...settings, _configName: existing._configName })","handlingStrategy":"validation","validationCode":"if (configId && (typeof config._configName !== 'string' || !config._configName.trim())) {\n  throw new Error('_configName is required when updating an existing config')\n}","typeGuard":"function hasConfigName(config) {\n  return typeof config._configName === 'string' && config._configName.trim() !== ''\n}","tryCatchPattern":"try {\n  await updateUploaderConfig(type, configId, config)\n} catch (e) {\n  if (e.message.includes('CONFIG_NAME_EMPTY')) {\n    config._configName = originalConfig._configName\n    await updateUploaderConfig(type, configId, config)\n  } else throw e\n}","preventionTips":["Always copy _configName from the existing config into update payloads","Require the name field in edit forms and validate non-empty","Never strip underscore-prefixed meta fields (_id, _configName) when spreading config objects"],"tags":["config","uploader","validation","missing-field"],"backgroundTag":"missing-required-field","analyzedSha":"07ec7068a5512344da093d49a8408fa63ba3421e","analyzedAt":"2026-08-30T01:45:22.289Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}