danny-avila/LibreChat · error
no_user_key
no_user_key
Error message
{"type":"no_user_key"} What it means
Azure Assistants variant of the no_user_key error. Thrown when the user is expected to supply their own Azure OpenAI key (userProvidesKey) but none was provided. Emits a JSON-stringified payload with type NO_USER_KEY for client-side detection. Uses the same single-'&' bitwise pattern as the non-Azure path.
Source
Thrown at api/server/services/Endpoints/azureAssistants/initialize.js:146
const groupName = modelGroupMap[modelName].group;
clientOptions.addParams = azureConfig.groupMap[groupName].addParams;
clientOptions.dropParams = azureConfig.groupMap[groupName].dropParams;
clientOptions.reverseProxyUrl = baseURL ?? clientOptions.reverseProxyUrl;
clientOptions.headers = opts.defaultHeaders;
clientOptions.azure = !serverless && azureOptions;
if (serverless === true) {
clientOptions.defaultQuery = azureOptions.azureOpenAIApiVersion
? { 'api-version': azureOptions.azureOpenAIApiVersion }
: undefined;
clientOptions.headers['api-key'] = apiKey;
}
}
}
if (userProvidesKey & !apiKey) {
throw new Error(
JSON.stringify({
type: ErrorTypes.NO_USER_KEY,
}),
);
}
if (!apiKey) {
throw new Error('Assistants API key not provided. Please provide it again.');
}
if (baseURL) {
opts.baseURL = baseURL;
}
const proxyDispatcher = getProxyDispatcher(PROXY);
if (proxyDispatcher) {
opts.fetchOptions = {
dispatcher: proxyDispatcher,View on GitHub (pinned to 5ff282f900)
Solutions
- Supply the Azure OpenAI key via userValues.apiKey and retry.
- If a server-managed key is preferred, configure the Azure credentials at the server level.
- Re-prompt the user to enter their Azure key through the no_user_key UI flow.
- Re-enter the stored credential to rule out corruption.
Example fix
// before
if (userProvidesKey & !apiKey) {
// after
if (userProvidesKey && !apiKey) { Defensive patterns
Strategy: validation
Validate before calling
if (userProvidesKey && !userValues.apiKey) {
return res.status(400).json({ error: 'An Azure OpenAI key is required for this endpoint' });
} Type guard
function hasAzureUserKey(userProvidesKey, userValues) {
return !userProvidesKey || typeof userValues?.apiKey === 'string' && userValues.apiKey.length > 0;
} Try / catch
try { await initializeAzure(req, res, version); }
catch (e) { if (e.message.includes('NO_USER_KEY')) return res.status(401).json({ code: 'no_user_key' }); throw e; } Prevention
- Validate the Azure key client-side when user-provided keys are required.
- Re-prompt on NO_USER_KEY; do not retry silently.
- Use '&&' rather than '&' in the guard condition.
When it happens
Trigger: An Azure Assistants endpoint configured for user-provided keys receives a request without an apiKey in userValues during initialization.
Common situations: User's Azure key cleared from storage; frontend submitted without the key; endpoint switched to user-provided-key mode without updating stored credentials.
Related errors
- no_user_key
- Assistants API key not provided. Please provide it again.
- Missing DALLE_API_KEY environment variable.
- Missing FLUX_API_KEY environment variable.
- Gemini Image Generation requires one of: user-provided API k
AI-assisted analysis of danny-avila/LibreChat@5ff282f900 (2026-08-12).
Data as JSON: /api/errors/5e9d5ebc663b9eee.
Report an issue: GitHub.