#15650·AFFiNE

[Bug]: Self-Hosted AI BYOK - Custom endpoints error "copilot.byok.allowCustomEndpoint" persists despite valid config.json and Admin UI toggle

Author: stepanhendrychCreated Sep 28, 2026Updated Sep 28, 2026

What happened?

Bug Description

When setting up self-hosted AFFiNE, configuring AI BYOK with custom endpoints results in the persistent error:

"Use a custom API-compatible endpoint. Custom endpoints are disabled by the server administrator. In Self-hosted Admin, enable copilot.byok.allowCustomEndpoint."

This error occurs even though:

  1. The configuration file is based on the official template, properly adjusted with custom server name/URL and expanded with allowCustomEndpoint: true under copilot.byok.
  2. The global Self-hosted Admin UI toggle for custom endpoints is enabled.
  3. The container successfully mounts and reads the config.json.
  4. The container has been completely re-created from scratch (clearing volumes as well).

Environment

  • AFFiNE Self-hosted (Docker)

Steps to Reproduce

  1. Start AFFiNE self-hosted via official Docker Compose using a customized version of the official config template.
  2. Enable custom endpoint toggles in the Admin panel.
  3. Try to configure a custom BYOK AI provider endpoint in newly created workspace.
  4. Observe the error message blocking the custom endpoint.

config.json used (adapted from the official template)

json
{
  "$schema": "https://github.com/toeverything/affine/releases/latest/download/config.schema.json",
  "server": {
    "name": "Štěpánovo AFFiNE",
    "externalUrl": "https://affine.█████.cz:3010"
  },
  "copilot": {
    "enabled": true,
    "byok": {
      "enabled": true,
      "allowCustomEndpoint": true,
      "allowPrivateEndpoint": false
    }
  }
}

I tried it even without "allowCustomEndpoint" and "allowPrivateEndpoint" or with just only one of them but it did not make any change.

Distribution version

Linux

App Version

Web version

What browsers are you seeing the problem on if you're using web version?

Chrome

Are you self-hosting?

  • Yes

Self-hosting Version

v0.27.4

Relevant log output

bash
admin@raspberryHosting:~/home-hosting/affine $ docker logs affine_server --tail 50
[Nest] 1  - 09/28/2026, 7:16:40 PM     LOG [job] Queue Worker [backendRuntime] started; concurrency=1;
[Nest] 1  - 09/28/2026, 7:16:40 PM     LOG [job] Queue Worker [inviteAbuse] started; concurrency=1;
[Nest] 1  - 09/28/2026, 7:16:40 PM     LOG [job] Queue Worker [doc] started; concurrency=1;
[Nest] 1  - 09/28/2026, 7:16:40 PM     LOG [job] Queue Worker [indexer] started; concurrency=1;
[Nest] 1  - 09/28/2026, 7:16:40 PM VERBOSE [EventBus] Handle event [config.init] (StorageRuntimeProvider.onConfigInit)
[Nest] 1  - 09/28/2026, 7:16:40 PM VERBOSE [EventBus] Handle event [config.init] (ManticoresearchProvider.onConfigInit)
[Nest] 1  - 09/28/2026, 7:16:40 PM VERBOSE [EventBus] Handle event [config.init] (ElasticsearchProvider.onConfigInit)
[Nest] 1  - 09/28/2026, 7:16:40 PM VERBOSE [EventBus] Handle event [config.init] (MailSender.onConfigInit)
[Nest] 1  - 09/28/2026, 7:16:40 PM VERBOSE [EventBus] Handle event [config.init] (TelemetryService.onConfigInit)
[Nest] 1  - 09/28/2026, 7:16:40 PM     LOG [TelemetryService] Telemetry allowed origins updated: http://localhost, http://127.0.0.1, https://affine.henyx.cz
[Nest] 1  - 09/28/2026, 7:16:40 PM VERBOSE [EventBus] Handle event [config.init] (StripeFactory.onConfigInit)
[Nest] 1  - 09/28/2026, 7:16:40 PM VERBOSE [EventBus] Handle event [config.init] (CaptchaService.onConfigInit)
[Nest] 1  - 09/28/2026, 7:16:40 PM VERBOSE [EventBus] Handle event [config.init] (GoogleOAuthProvider.onConfigInit)
[Nest] 1  - 09/28/2026, 7:16:40 PM     LOG [OAuthProviderFactory] OAuth provider [google] unregistered.
[Nest] 1  - 09/28/2026, 7:16:40 PM VERBOSE [EventBus] Handle event [config.init] (GithubOAuthProvider.onConfigInit)
[Nest] 1  - 09/28/2026, 7:16:40 PM     LOG [OAuthProviderFactory] OAuth provider [github] unregistered.
[Nest] 1  - 09/28/2026, 7:16:40 PM VERBOSE [EventBus] Handle event [config.init] (OIDCProvider.onConfigInit)
[Nest] 1  - 09/28/2026, 7:16:40 PM     LOG [OAuthProviderFactory] OAuth provider [oidc] unregistered.
[Nest] 1  - 09/28/2026, 7:16:40 PM VERBOSE [EventBus] Handle event [config.init] (AppleOAuthProvider.onConfigInit)
[Nest] 1  - 09/28/2026, 7:16:40 PM     LOG [OAuthProviderFactory] OAuth provider [apple] unregistered.
[Nest] 1  - 09/28/2026, 7:16:40 PM VERBOSE [EventBus] Handle event [config.init] (GoogleCalendarProvider.onConfigInit)
[Nest] 1  - 09/28/2026, 7:16:40 PM     LOG [CalendarProviderFactory] Calendar provider [google] unregistered.
[Nest] 1  - 09/28/2026, 7:16:40 PM VERBOSE [EventBus] Handle event [config.init] (CalDAVProvider.onConfigInit)
[Nest] 1  - 09/28/2026, 7:16:40 PM     LOG [CalendarProviderFactory] Calendar provider [caldav] unregistered.
[Nest] 1  - 09/28/2026, 7:16:40 PM VERBOSE [EventBus] Handle event [config.init] (WorkerService.onConfigInit)
[Nest] 1  - 09/28/2026, 7:16:40 PM VERBOSE [EventBus] Handle event [config.init] (CopilotFeatureService.onConfigInit)
[Nest] 1  - 09/28/2026, 7:16:40 PM     LOG [StorageRuntimeProvider] storage runtime started: db=true provider=fs
[Nest] 1  - 09/28/2026, 7:16:40 PM     LOG [AuthSigningKeyRing] Initialized auth signing key ring from the database.
[Nest] 1  - 09/28/2026, 7:16:40 PM     LOG [NestApplication] Nest application successfully started
[Nest] 1  - 09/28/2026, 7:16:40 PM     LOG [WorkspaceResolver] AFFiNE Server is running in [selfhosted] mode
[Nest] 1  - 09/28/2026, 7:16:40 PM     LOG [WorkspaceResolver] Listening on http://0.0.0.0:3010
[Nest] 1  - 09/28/2026, 7:16:40 PM     LOG [WorkspaceResolver] And the public server should be recognized as https://affine.henyx.cz
[Nest] 1  - 09/28/2026, 7:16:54 PM VERBOSE [Locker] <selfhosted:http:0a83c15c-3e18-46a4-a4e3-e561c6f47854> Client cluster:2sBBll9DFzqzevT9adAq5:xUbMSSx47zpQsE_sfX2md is trying to lock resource doc:update:c2397d7f-d2a2-423d-a004-673a8989e841:c2397d7f-d2a2-423d-a004-673a8989e841
[Nest] 1  - 09/28/2026, 7:16:54 PM   DEBUG [SpaceSyncGateway] New connection, total: 1
[Nest] 1  - 09/28/2026, 7:16:54 PM VERBOSE [Locker] <selfhosted:ws:f7598f49-a02e-467d-af30-5ab8d421cd93> Client cluster:2sBBll9DFzqzevT9adAq5:k5GEN9LU--vvsFEj4V5h_ is trying to lock resource doc:update:c2397d7f-d2a2-423d-a004-673a8989e841:c2397d7f-d2a2-423d-a004-673a8989e841
[Nest] 1  - 09/28/2026, 7:16:55 PM VERBOSE [Locker] <selfhosted:http:5d3884b3-e941-426d-8759-1fa89069f078> Client cluster:2sBBll9DFzqzevT9adAq5:zlxxhz7vicoKvewsk0RJE is trying to lock resource doc:update:c2397d7f-d2a2-423d-a004-673a8989e841:c2397d7f-d2a2-423d-a004-673a8989e841
[Nest] 1  - 09/28/2026, 7:16:57 PM VERBOSE [Locker] <selfhosted:http:e63cef6a-c334-4565-9bd2-f2dd83537552> Client cluster:2sBBll9DFzqzevT9adAq5:idtwE2GGUHYu87zFyBwTT is trying to lock resource doc:update:c2397d7f-d2a2-423d-a004-673a8989e841:c2397d7f-d2a2-423d-a004-673a8989e841
[Nest] 1  - 09/28/2026, 7:17:00 PM     LOG [MonitorService] memory usage: rss: 110764032, heapTotal: 130985984, heapUsed: 124791880, external: 5351751, arrayBuffers: 240107
[Nest] 1  - 09/28/2026, 7:17:00 PM   DEBUG [JobQueue] Job [doc.findEmptySummaryDocs] added; id=findEmptySummaryDocs
[Nest] 1  - 09/28/2026, 7:17:00 PM   DEBUG [JobQueue] Job [inviteAbuse.executePendingActions] added; id=invite-abuse-execute-pending-actions
[Nest] 1  - 09/28/2026, 7:17:00 PM   DEBUG [JobQueue] Job [doc.recordPendingDocUpdatesCount] added; id=doc%3Arecord-pending-updates-count
[Nest] 1  - 09/28/2026, 7:17:00 PM VERBOSE [job] <selfhosted:job:ed6f89bd-a601-4f7a-a7ab-6f882c5c8b1b> Job started: [inviteAbuse.executePendingActions] (InviteAbuseDispositionService.executePendingActions, id=invite-abuse-execute-pending-actions)
[Nest] 1  - 09/28/2026, 7:17:00 PM VERBOSE [job] <selfhosted:job:ed6f89bd-a601-4f7a-a7ab-6f882c5c8b1b> Object(0) {}
[Nest] 1  - 09/28/2026, 7:17:00 PM VERBOSE [job] <selfhosted:job:ed6f89bd-a601-4f7a-a7ab-6f882c5c8b1b> Job finished: [inviteAbuse.executePendingActions] (InviteAbuseDispositionService.executePendingActions, id=invite-abuse-execute-pending-actions)
[Nest] 1  - 09/28/2026, 7:17:00 PM VERBOSE [job] <selfhosted:job:ed6f89bd-a601-4f7a-a7ab-6f882c5c8b1b> Object(3) {
  signature: '[inviteAbuse.executePendingActions] (InviteAbuseDispositionService.executePendingActions, id=invite-abuse-execute-pending-actions)',
  signal: undefined,
  cost: 80
}
[Nest] 1  - 09/28/2026, 7:17:00 PM VERBOSE [Locker] <selfhosted:http:8358df51-7378-4ec4-9bb3-6d0d09ec1bdc> Client cluster:2sBBll9DFzqzevT9adAq5:_NWv2PSpMpgeQqYBmhY7q is trying to lock resource doc:update:c2397d7f-d2a2-423d-a004-673a8989e841:c2397d7f-d2a2-423d-a004-673a8989e841

Anything else?

It might just be fault completely on my end and pure stupidity, but I tried to set this up to the best of my knowledge and followed every configuration step available. If I missed something obvious, I apologize!

Is your content generated by AI?

  • I confirm that the content I submitted was not generated by AI / merely contained minimal AI edits.