{"record":{"id":"acb8ae1c46618085","repo":"toeverything/AFFiNE","slug":"server-with-same-base-url-already-exists-server","errorCode":null,"errorMessage":"Server with same base url already exists, ${server.baseUrl}","messagePattern":"Server with same base url already exists, (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/frontend/core/src/modules/cloud/stores/server-list.ts","lineNumber":39,"sourceCode":"      );\n  }\n\n  getServerList() {\n    return [\n      ...BUILD_IN_SERVERS,\n      ...(this.globalStateService.globalState.get<ServerMetadata[]>(\n        'serverList'\n      ) ?? []),\n    ];\n  }\n\n  addServer(server: ServerMetadata, serverConfig: ServerConfig) {\n    const oldServers =\n      this.globalStateService.globalState.get<ServerMetadata[]>('serverList') ??\n      [];\n\n    if (oldServers.some(s => s.baseUrl === server.baseUrl)) {\n      throw new Error(\n        'Server with same base url already exists, ' + server.baseUrl\n      );\n    }\n\n    this.updateServerConfig(server.id, serverConfig);\n    this.globalStateService.globalState.set<ServerMetadata[]>('serverList', [\n      ...oldServers,\n      server,\n    ]);\n  }\n\n  removeServer(serverId: string) {\n    const oldServers =\n      this.globalStateService.globalState.get<ServerMetadata[]>('serverList') ??\n      [];\n\n    this.globalStateService.globalState.set<ServerMetadata[]>(\n      'serverList',","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/toeverything/AFFiNE/blob/b4c8548c09da21b2898443559a5b846f0ccf5dd8/packages/frontend/core/src/modules/cloud/stores/server-list.ts#L21-L57","documentation":"A uniqueness guard in the server-list store: addServer checks the persisted serverList for an existing entry whose baseUrl equals the new server's baseUrl. It fires on an attempt to register a custom server whose base URL was already added, because the list is keyed by base URL; the interpolated value is the duplicated base URL.","triggerScenarios":"Thrown in ServerListStore.addServer when a stored server already has the same baseUrl as the one being added.","commonSituations":"Occurs when a user tries to add a self-hosted server that is already in the list. Use the existing entry instead of adding a duplicate.","solutions":["The server is already in the list; select the existing entry instead.","Remove the existing entry first if you intend to re-add it."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b4c8548c09da21b2898443559a5b846f0ccf5dd8","analyzedAt":"2026-08-18T21:16:52.546Z","contentChangedAt":"2026-08-18T21:16:52.546Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}