{"record":{"id":"381060365c4820ae","repo":"chatboxai/chatbox","slug":"custom-provider-providerid-conflicts-with-a-b","errorCode":null,"errorMessage":"Custom provider \"${providerId}\" conflicts with a builtin provider ID","messagePattern":"Custom provider \"(.+?)\" conflicts with a builtin provider ID","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/renderer/components/settings/provider/importProviderState.ts","lineNumber":61,"sourceCode":"  }\n  if ('sessionToken' in importedConfig && importedConfig.sessionToken) {\n    credentialFields.sessionToken = importedConfig.sessionToken as string\n  }\n  if ('region' in importedConfig && importedConfig.region) {\n    credentialFields.region = importedConfig.region as string\n  }\n\n  const providerSettings = {\n    ...providers?.[providerId],\n    apiHost,\n    apiPath,\n    apiKey,\n    ...credentialFields,\n    models: uniqueModels,\n  }\n\n  if ('isCustom' in importedConfig && importedConfig.isCustom && isBuiltinProviderId(providerId)) {\n    throw new Error(`Custom provider \"${providerId}\" conflicts with a builtin provider ID`)\n  }\n\n  if (existingProvider && !existingProvider.isCustom) {\n    return {\n      providers: {\n        ...providers,\n        [providerId]: providerSettings,\n      },\n    }\n  }\n\n  const baseProviderInfo: CustomProviderBaseInfo = {\n    id: providerId,\n    name: providerName,\n    type: providerType,\n    iconUrl: 'iconUrl' in importedConfig ? importedConfig.iconUrl : undefined,\n    urls,\n    isCustom: true,","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/chatboxai/chatbox/blob/81571269addb6bafb589a920b2883f1e1e084fd1/src/renderer/components/settings/provider/importProviderState.ts#L43-L79","documentation":"Thrown by buildImportedProviderSettingsUpdate when an imported provider config is marked isCustom: true but its id matches a builtin provider id (e.g. 'openai', 'anthropic', 'google'). This prevents a custom provider definition from shadowing or colliding with the hardcoded builtin catalog, which would break provider resolution and credential routing.","triggerScenarios":"Importing a shared/exported provider JSON whose id is 'openai' (or another builtin) and whose isCustom flag is true. isBuiltinProviderId(providerId) returns true, so the guard fires. The check runs after models are deduped and provider settings assembled, so all other fields are valid by this point.","commonSituations":"A user exports a custom provider, manually edits the JSON to use a builtin id (or renames it to clash), then imports; a team-sharing config reuses a builtin id by mistake; a migration script assigns ids that overlap the builtin set.","solutions":["Change the imported provider's id to a non-builtin value (e.g. 'openai-custom' or a generated uuid) before importing.","If the intent is to override the builtin provider, import it WITHOUT isCustom: true so it updates the builtin entry instead.","Validate the id against isBuiltinProviderId() in the import UI and prompt the user to rename."],"exampleFix":"// before\nif ('isCustom' in importedConfig && importedConfig.isCustom && isBuiltinProviderId(providerId)) {\n  throw new Error(`Custom provider \"${providerId}\" conflicts with a builtin provider ID`)\n}\n\n// after — auto-suffix the id and warn instead of hard-failing\nlet finalId = providerId\nif ('isCustom' in importedConfig && importedConfig.isCustom && isBuiltinProviderId(providerId)) {\n  finalId = `${providerId}-custom`\n  log.warn(`Imported custom provider id clashed with builtin; renamed to ${finalId}`)\n}","handlingStrategy":"validation","validationCode":"import { isBuiltinProviderId } from '@shared/providers'\nfunction validateImportedId(id: string, isCustom: boolean): string {\n  if (isCustom && isBuiltinProviderId(id)) {\n    return `${id}-custom` // or throw\n  }\n  return id\n}","typeGuard":"function isBuiltinId(id: string): boolean {\n  return isBuiltinProviderId(id)\n}","tryCatchPattern":"try {\n  return buildImportedProviderSettingsUpdate(params)\n} catch (error) {\n  if (error instanceof Error && /conflicts with a builtin/i.test(error.message)) {\n    showToast(`The provider id \"${id}\" is reserved. Rename it before importing.`)\n    return {}\n  }\n  throw error\n}","preventionTips":["Validate the imported id against isBuiltinProviderId() in the import UI before submitting.","If overriding a builtin, import without isCustom: true.","Suffix custom ids with a namespace (e.g. 'team-') to avoid accidental collisions."],"tags":["settings","provider","import","validation","config"],"backgroundTag":null,"analyzedSha":"81571269addb6bafb589a920b2883f1e1e084fd1","analyzedAt":"2026-08-12T21:51:44.981Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}