{"record":{"id":"07d8b8d189cc6a69","repo":"continuedev/continue","slug":"invalid-cometapi-base-url-options-apibase-exp","errorCode":null,"errorMessage":"Invalid CometAPI base URL: ${options.apiBase}. Expected https://api.cometapi.com/v1/ or compatible endpoint","messagePattern":"Invalid CometAPI base URL: (.+?)\\. Expected https://api\\.cometapi\\.com/v1/ or compatible endpoint","errorType":"validation","errorClass":"CometAPIError","httpStatus":null,"severity":"error","filePath":"core/llm/llms/CometAPI.ts","lineNumber":85,"sourceCode":"  }\n\n  /**\n   * Validate CometAPI configuration\n   */\n  private static validateConfig(options: LLMOptions): void {\n    // Allow constructing without API key (tests that only instantiate should pass).\n    // Enforce credentials at request time instead.\n    if (!options.apiKey) {\n      if (typeof process !== \"undefined\" && process.env?.NODE_ENV !== \"test\") {\n        console.warn(\n          \"CometAPI: No API key provided. Requests will fail until an API key is configured. Get one at https://api.cometapi.com/console/token\",\n        );\n      }\n      return;\n    }\n\n    if (options.apiBase && !CometAPI.isValidApiBase(options.apiBase)) {\n      throw new CometAPIError(\n        `Invalid CometAPI base URL: ${options.apiBase}. Expected https://api.cometapi.com/v1/ or compatible endpoint`,\n      );\n    }\n\n    if (\n      options.model &&\n      !CometAPI.isValidModelFormat(options.model) &&\n      typeof process !== \"undefined\" &&\n      process.env?.NODE_ENV !== \"test\"\n    ) {\n      console.warn(\n        `CometAPI: Model \"${options.model}\" may not be supported. Check CometAPI documentation for available models.`,\n      );\n    }\n  }\n\n  /**\n   * Validate API base URL format","sourceCodeStart":67,"sourceCodeEnd":103,"githubUrl":"https://github.com/continuedev/continue/blob/5522c6f44ca0ac3528b37244818fbfa39b5af470/core/llm/llms/CometAPI.ts#L67-L103","documentation":"Validation error thrown by CometAPI.validateConfig (invoked from the constructor) when a custom apiBase is supplied that fails CometAPI.isValidApiBase — i.e. it is not https://api.cometapi.com/v1/ or a compatible OpenAI-style endpoint. Prevents constructing a client pointed at an unusable URL.","triggerScenarios":"Instantiating CometAPI with options.apiBase set to a typo'd domain, a non-/v1/ path, a URL missing the protocol, or a third-party proxy that doesn't mimic the CometAPI OpenAI-compatible shape.","commonSituations":"Copy-pasting an OpenAI base URL (https://api.openai.com/v1/) instead of CometAPI's, trailing-slash or /v1/-missing variants, self-hosted proxy URLs that need to be allowlisted/extended in isValidApiBase.","solutions":["Use exactly https://api.cometapi.com/v1/ as apiBase","If you need a proxy/custom gateway, ensure its URL ends with a /v1/-style OpenAI-compatible path accepted by isValidApiBase, or omit apiBase entirely","Remove the apiBase option if you intend the default endpoint","Check for typos: scheme (https), host, and /v1/ suffix"],"exampleFix":"// before\nnew CometAPI({ apiBase: 'https://api.cometapi.com', ... });\n// after\nnew CometAPI({ apiBase: 'https://api.cometapi.com/v1/', ... });","handlingStrategy":"validation","validationCode":"const BASE = 'https://api.cometapi.com/v1/';\nif (apiBase && !/^https:\\/\\/[^/]+\\/v1\\/?$/.test(apiBase)) apiBase = BASE;","typeGuard":"function isValidCometBase(u: string): boolean {\n  try { const x = new URL(u); return x.pathname.replace(/\\/+$/, '') === '/v1'; } catch { return false; }\n}","tryCatchPattern":"try { new CometAPI(opts); } catch (e) {\n  if (e instanceof Error && e.message.startsWith('Invalid CometAPI base URL')) opts.apiBase = 'https://api.cometapi.com/v1/';\n  throw e;\n}","preventionTips":["Use the documented default and omit apiBase","Validate URL shape before constructing","Avoid pasting OpenAI base URLs"],"tags":["cometapi","config","validation","base-url"],"backgroundTag":"invalid-base-url","analyzedSha":"5522c6f44ca0ac3528b37244818fbfa39b5af470","analyzedAt":"2026-08-27T11:28:54.683Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}