toeverything/AFFiNE · error · Error

Server with same base url already exists, ${server.baseUrl}

Error message

Server with same base url already exists, ${server.baseUrl}

What it means

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.

Source

Thrown at packages/frontend/core/src/modules/cloud/stores/server-list.ts:39

      );
  }

  getServerList() {
    return [
      ...BUILD_IN_SERVERS,
      ...(this.globalStateService.globalState.get<ServerMetadata[]>(
        'serverList'
      ) ?? []),
    ];
  }

  addServer(server: ServerMetadata, serverConfig: ServerConfig) {
    const oldServers =
      this.globalStateService.globalState.get<ServerMetadata[]>('serverList') ??
      [];

    if (oldServers.some(s => s.baseUrl === server.baseUrl)) {
      throw new Error(
        'Server with same base url already exists, ' + server.baseUrl
      );
    }

    this.updateServerConfig(server.id, serverConfig);
    this.globalStateService.globalState.set<ServerMetadata[]>('serverList', [
      ...oldServers,
      server,
    ]);
  }

  removeServer(serverId: string) {
    const oldServers =
      this.globalStateService.globalState.get<ServerMetadata[]>('serverList') ??
      [];

    this.globalStateService.globalState.set<ServerMetadata[]>(
      'serverList',

View on GitHub (pinned to b4c8548c09)

Solutions

  1. The server is already in the list; select the existing entry instead.
  2. Remove the existing entry first if you intend to re-add it.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown in ServerListStore.addServer when a stored server already has the same baseUrl as the one being added.

Common situations: 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.


AI-assisted analysis of toeverything/AFFiNE@b4c8548c09 (2026-08-18). Data as JSON: /api/errors/acb8ae1c46618085. Report an issue: GitHub.