{"record":{"id":"0799e945f805f5a2","repo":"Molunerfinn/PicGo","slug":"config-not-found","errorCode":null,"errorMessage":"Config not found","messagePattern":"Config not found","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/renderer/store/providers/actions.ts","lineNumber":42,"sourceCode":"  }\n}\n\nfunction getConfigState (providerId: string) {\n  return useAppStore.getState().appConfig?.uploader?.[providerId]\n}\n\nfunction getConfigItemById (\n  providerId: string,\n  configId: string\n): ProviderUploaderConfigItem | null {\n  return getConfigState(providerId)?.configList.find((item) => item._id === configId) ?? null\n}\n\nfunction getConfigNameById (providerId: string, configId: string) {\n  const configItem = getConfigItemById(providerId, configId)\n\n  if (!configItem) {\n    throw new Error(i18n.t('TIPS_UPLOADER_CONFIG_NOT_FOUND'))\n  }\n\n  return configItem._configName\n}\n\nasync function runWithProviderLoading<T> (\n  providerId: string,\n  task: () => Promise<T>\n) {\n  providerStoreActions.setLoadingByProvider(providerId, true)\n\n  try {\n    return await task()\n  } finally {\n    providerStoreActions.setLoadingByProvider(providerId, false)\n  }\n}\n","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/Molunerfinn/PicGo/blob/07ec7068a5512344da093d49a8408fa63ba3421e/src/renderer/store/providers/actions.ts#L24-L60","documentation":"getConfigNameById resolves a provider config's display name (_configName) from its id. It throws the localized TIPS_UPLOADER_CONFIG_NOT_FOUND error when getConfigItemById returns nothing, i.e. no config with that id exists under the given providerId. Callers use it to derive configName/sourceConfigName for rename/copy flows.","triggerScenarios":"Calling getConfigNameById(providerId, configId) where configId was deleted, belongs to a different provider, or the provider's configList has not been loaded into the store yet.","commonSituations":"A stale configId persisted in UI state after the config was removed in another window; passing the providerId where configId belongs; operating on configs before hydrateAppState() populated the provider store.","solutions":["Verify the config id exists via getConfigState(providerId)?.configList before resolving its name.","Refresh provider state (hydrate app state) if the config was created recently or modified in another window.","Confirm the (providerId, configId) pair matches — ids are scoped per provider.","Use the return value of createConfig/copyConfig (they return _id) rather than reconstructing ids by hand."],"exampleFix":"// before\nconst configName = getConfigNameById(providerId, configId)\n\n// after\nconst exists = getConfigState(providerId)?.configList.some(\n  (item) => item._id === configId\n)\nif (!exists) {\n  toast.warning(i18n.t('TIPS_UPLOADER_CONFIG_NOT_FOUND'))\n  return\n}\nconst configName = getConfigNameById(providerId, configId)","handlingStrategy":"validation","validationCode":"const configItem = getConfigState(providerId)?.configList.find(\n  (item) => item._id === configId\n)\nif (!configItem) {\n  // config gone or wrong provider — bail before name lookup\n  return\n}","typeGuard":"function configExists(\n  item: ProviderConfigItem | undefined\n): item is ProviderConfigItem & { _configName: string } {\n  return !!item && typeof item._configName === 'string'\n}","tryCatchPattern":"try {\n  const configName = getConfigNameById(providerId, configId)\n} catch (err) {\n  toast.warning(i18n.t('TIPS_UPLOADER_CONFIG_NOT_FOUND'))\n}","preventionTips":["Source configIds from the current configList, not cached/persisted copies.","Hydrate provider state before operating on configs.","Remember config ids are provider-scoped — always pair with the right providerId.","Clean up UI selections when a config is deleted elsewhere."],"tags":["uploader","config","state-store","validation"],"backgroundTag":"uploader-config-not-found","analyzedSha":"07ec7068a5512344da093d49a8408fa63ba3421e","analyzedAt":"2026-08-30T01:45:22.289Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}