danny-avila/LibreChat · error · Error
[${req.baseUrl}] Endpoint is required
Error message
[${req.baseUrl}] Endpoint is required What it means
Thrown by getOpenAIClient after it resolves the API version but finds no endpoint identifier. The endpoint is sourced from overrideEndpoint, then req.body.endpoint, then req.query.endpoint; if all are absent the call cannot decide whether to initialize the OpenAI or Azure Assistants client and aborts.
Source
Thrown at api/server/controllers/assistants/helpers.js:192
data,
};
};
/**
* Initializes the OpenAI client.
* @param {object} params - The parameters object.
* @param {ServerRequest} params.req - The request object.
* @param {ServerResponse} params.res - The response object.
* @param {TEndpointOption} params.endpointOption - The endpoint options.
* @param {boolean} params.initAppClient - Whether to initialize the app client.
* @param {string} params.overrideEndpoint - The endpoint to override.
* @returns {Promise<{ openai: OpenAI, openAIApiKey: string }>} - The initialized OpenAI SDK client.
*/
async function getOpenAIClient({ req, res, endpointOption, initAppClient, overrideEndpoint }) {
let endpoint = overrideEndpoint ?? req.body?.endpoint ?? req.query?.endpoint;
const version = await getCurrentVersion(req, endpoint);
if (!endpoint) {
throw new Error(`[${req.baseUrl}] Endpoint is required`);
}
let result;
if (endpoint === EModelEndpoint.assistants) {
result = await initializeClient({ req, res, version, endpointOption, initAppClient });
} else if (endpoint === EModelEndpoint.azureAssistants) {
result = await initAzureClient({ req, res, version, endpointOption, initAppClient });
}
return result;
}
/**
* Returns a list of assistants.
* @param {object} params
* @param {object} params.req - Express Request
* @param {AssistantListParams} [params.req.query] - The assistant list parameters for pagination and sorting.
* @param {object} params.res - Express ResponseView on GitHub (pinned to 5ff282f900)
Solutions
- Include endpoint: 'assistants' (or 'azureAssistants') in the request body or query string.
- If calling getOpenAIClient server-side, pass overrideEndpoint explicitly.
- Verify the client/integration still sends the endpoint field after upgrades to the assistants API.
Example fix
// before
fetch('/api/assistants', { method: 'POST', body: JSON.stringify({ name }) })
// after
fetch('/api/assistants', { method: 'POST', body: JSON.stringify({ name, endpoint: 'assistants' }) }) Defensive patterns
Strategy: validation
Validate before calling
const endpoint = overrideEndpoint ?? req.body?.endpoint ?? req.query?.endpoint;
if (!endpoint) {
return res.status(400).json({ error: 'endpoint query/body parameter is required' });
} Type guard
function hasEndpointArg(req, override) {
const e = override ?? req.body?.endpoint ?? req.query?.endpoint;
return typeof e === 'string' && e.length > 0;
} Try / catch
try { await getOpenAIClient({ req, res }); }
catch (e) { if (/Endpoint is required/.test(e.message)) return res.status(400).json({ error: e.message }); throw e; } Prevention
- Make the endpoint field required in the request schema/DTO.
- Default to 'assistants' on the client when the user selects that provider.
- Fail fast in middleware if endpoint is missing for assistants routes.
When it happens
Trigger: A POST/GET to the assistants controller that omits the 'endpoint' field in both body and query, and is invoked without an explicit overrideEndpoint argument (e.g. a direct programmatic call or a client that previously relied on a default).
Common situations: Frontend form that stopped sending the endpoint field after a refactor; a custom integration calling the assistants API directly without setting endpoint to 'assistants' or 'azureAssistants'; a misrouted request hitting this controller for a non-assistants action.
Related errors
- [${req.baseUrl}] Invalid version: ${version}
- Trouble deleting Assistant Actions for Assistant ID: ${assis
- Unexpected run status ${run.status}.\nFull run info:\n\n${ru
- no_user_key
- Assistants API key not provided. Please provide it again.
AI-assisted analysis of danny-avila/LibreChat@5ff282f900 (2026-08-12).
Data as JSON: /api/errors/e5d7709fadf20ce4.
Report an issue: GitHub.