OtterMind/Chat2DB · error · Error
The baseURL is not valid!
Error message
The baseURL is not valid!
What it means
HTTPSRequestClass.init throws when options.baseURL is falsy or not a string. This is the HTTPS (direct fetch) variant of the SSE request manager, parallel to ClientRequestClass. It validates the URL before using it as the singleton cache key and as the fetch target. Without a valid URL, the streaming POST cannot be dispatched.
Source
Thrown at chat2db-community-client/src/components/SSERequest/sseHttpsRequest.ts:32
private constructor(options: SSERequestOptions) {
const { baseURL, model } = options;
this.baseURL = baseURL;
this.model = model;
this.defaultHeaders = {
'Content-Type': 'application/json',
Accept: 'text/event-stream, application/json',
'Cache-Control': 'no-cache',
...(options.dangerouslyApiKey && {
Authorization: options.dangerouslyApiKey,
}),
'Accept-Language': options.lang || 'en-US',
};
}
public static init(options: SSERequestOptions): HTTPSRequestClass {
if (!options.baseURL || typeof options.baseURL !== 'string') {
throw new Error('The baseURL is not valid!');
}
const id = options.baseURL;
if (!HTTPSRequestClass.instanceBuffer.has(id)) {
HTTPSRequestClass.instanceBuffer.set(id, new HTTPSRequestClass(options));
}
return HTTPSRequestClass.instanceBuffer.get(id)!;
}
public create = <Input = AnyObject, Output = SSEOutput>(
params: SSERequestParams & Input,
callbacks: SSERequestCallbacks<Output>,
transformStream?: SSEStreamProps<Output>['transformStream'],
): SSERequestHandle => {
return createAbortableRequestHandle(async (signal) => {
const requestInit = {View on GitHub (pinned to 5ee1e990e7)
Solutions
- Ensure the AI endpoint configuration is loaded and non-empty before calling init.
- Add a null/empty check before init and defer or skip if baseURL is invalid.
- Provide a configurable default endpoint as a fallback.
Example fix
// before
const req = HTTPSRequestClass.init({ baseURL, model });
// after
if (!baseURL || typeof baseURL !== 'string') {
throw new Error('AI endpoint not configured');
}
const req = HTTPSRequestClass.init({ baseURL, model }); Defensive patterns
Strategy: validation
Validate before calling
if (!baseURL || typeof baseURL !== 'string') {
throw new Error('AI SSE endpoint (baseURL) must be configured before init');
}
HTTPSRequestClass.init({ baseURL, model }); Type guard
function isNonEmptyString(v: unknown): v is string {
return typeof v === 'string' && v.trim().length > 0;
} Prevention
- Ensure AI settings (baseURL) are loaded before the HTTPS request handler initializes.
- Provide a default endpoint from environment config.
- Defer component mount until config is resolved.
When it happens
Trigger: Calling HTTPSRequestClass.init({ baseURL: undefined | null | '' | <number>, model, ... }) — most commonly when AI provider configuration is missing, empty, or loaded asynchronously after init is called.
Common situations: AI settings not yet loaded from backend. User hasn't configured a custom AI endpoint. Config fetch failed and returned undefined, which propagates as baseURL. Environment variable for the AI endpoint not set in the deployment.
Related errors
- The baseURL is not valid!
- Fetch failed with status ${response.status}
- The response body is empty.
- The response content-type: ${contentType} is not support!
- Missing file
AI-assisted analysis of OtterMind/Chat2DB@5ee1e990e7 (2026-08-14).
Data as JSON: /api/errors/ee2198fb7075b6a6.
Report an issue: GitHub.