toeverything/AFFiNE · error · Error
Unsupported BYOK provider.
Error message
Unsupported BYOK provider.
What it means
normalizeKey validates the key's provider against the allowedProviders set; a provider outside the allowlist (e.g. misspelled or unsupported) is rejected with this Error. Called by encryptKey, decryptKey, and nextKey.
Source
Thrown at packages/frontend/apps/electron/src/main/byok-storage/handlers.ts:162
isRecord(model) &&
typeof model.modelId === 'string' &&
model.modelId.trim().length > 0 &&
model.modelId.length <= 512 &&
typeof model.enabled === 'boolean' &&
Array.isArray(model.capabilities) &&
model.capabilities.length > 0 &&
model.capabilities.every(isValidCapability)
)
);
}
function normalizeKey(
key: WorkspaceByokKeyInput,
existing?: WorkspaceByokKey,
defaultSortOrder = 0
): WorkspaceByokKey {
if (!allowedProviders.has(key.provider)) {
throw new Error('Unsupported BYOK provider.');
}
const credential = key.credential ?? existing?.credential;
const definition = key.definition ?? existing?.definition;
if (
definition?.endpoint.kind === 'openai_compatible' &&
key.provider !== 'openai'
) {
throw new Error('OpenAI-compatible endpoints require OpenAI provider.');
}
if (!key.id || !key.name || !credential || !isValidDefinition(definition)) {
throw new Error('Invalid BYOK key.');
}
return {
id: key.id,
provider: key.provider,
name: key.name,
description: hasOwnField(key, 'description')
? (key.description ?? null)View on GitHub (pinned to b4c8548c09)
Solutions
- Choose one of the supported BYOK providers listed in the settings UI.
- Fix the provider identifier passed from the client to match a supported value.
- Update the app if the provider was added in a newer version.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at packages/frontend/apps/electron/src/main/byok-storage/handlers.ts:162 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of toeverything/AFFiNE@b4c8548c09 (2026-08-18).
Data as JSON: /api/errors/fc191d38497bf7e9.
Report an issue: GitHub.