{"record":{"id":"ee2198fb7075b6a6","repo":"OtterMind/Chat2DB","slug":"the-baseurl-is-not-valid-ee2198","errorCode":null,"errorMessage":"The baseURL is not valid!","messagePattern":"The baseURL is not valid!","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"chat2db-community-client/src/components/SSERequest/sseHttpsRequest.ts","lineNumber":32,"sourceCode":"  private constructor(options: SSERequestOptions) {\n    const { baseURL, model } = options;\n\n    this.baseURL = baseURL;\n    this.model = model;\n    this.defaultHeaders = {\n      'Content-Type': 'application/json',\n      Accept: 'text/event-stream, application/json',\n      'Cache-Control': 'no-cache',\n      ...(options.dangerouslyApiKey && {\n        Authorization: options.dangerouslyApiKey,\n      }),\n      'Accept-Language': options.lang || 'en-US',\n    };\n  }\n\n  public static init(options: SSERequestOptions): HTTPSRequestClass {\n    if (!options.baseURL || typeof options.baseURL !== 'string') {\n      throw new Error('The baseURL is not valid!');\n    }\n\n    const id = options.baseURL;\n\n    if (!HTTPSRequestClass.instanceBuffer.has(id)) {\n      HTTPSRequestClass.instanceBuffer.set(id, new HTTPSRequestClass(options));\n    }\n\n    return HTTPSRequestClass.instanceBuffer.get(id)!;\n  }\n\n  public create = <Input = AnyObject, Output = SSEOutput>(\n    params: SSERequestParams & Input,\n    callbacks: SSERequestCallbacks<Output>,\n    transformStream?: SSEStreamProps<Output>['transformStream'],\n  ): SSERequestHandle => {\n    return createAbortableRequestHandle(async (signal) => {\n      const requestInit = {","sourceCodeStart":14,"sourceCodeEnd":50,"githubUrl":"https://github.com/OtterMind/Chat2DB/blob/5ee1e990e73fbcae1969dc554be254fedb3ab888/chat2db-community-client/src/components/SSERequest/sseHttpsRequest.ts#L14-L50","documentation":"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.","triggerScenarios":"Calling HTTPSRequestClass.init({ baseURL: undefined | null | '' | <number>, model, ... }) — most commonly when AI provider configuration is missing, empty, or loaded asynchronously after init is called.","commonSituations":"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.","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."],"exampleFix":"// before\nconst req = HTTPSRequestClass.init({ baseURL, model });\n\n// after\nif (!baseURL || typeof baseURL !== 'string') {\n  throw new Error('AI endpoint not configured');\n}\nconst req = HTTPSRequestClass.init({ baseURL, model });","handlingStrategy":"validation","validationCode":"if (!baseURL || typeof baseURL !== 'string') {\n  throw new Error('AI SSE endpoint (baseURL) must be configured before init');\n}\nHTTPSRequestClass.init({ baseURL, model });","typeGuard":"function isNonEmptyString(v: unknown): v is string {\n  return typeof v === 'string' && v.trim().length > 0;\n}","tryCatchPattern":null,"preventionTips":["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."],"tags":["sse","ai","config","validation","frontend"],"backgroundTag":null,"analyzedSha":"5ee1e990e73fbcae1969dc554be254fedb3ab888","analyzedAt":"2026-08-14T07:05:03.077Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}