{"record":{"id":"007ef535182e3a5a","repo":"continuedev/continue","slug":"no-models-available-in-assistant-configuration","errorCode":null,"errorMessage":"No models available in assistant configuration","messagePattern":"No models available in assistant configuration","errorType":"error_code","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/continue-sdk/typescript/src/Assistant.ts","lineNumber":33,"sourceCode":"   * Create a new Assistant instance\n   *\n   * @param config - The raw assistant configuration\n   */\n  constructor(config: any) {\n    this.config = config;\n  }\n\n  /**\n   * Get a model from the assistant by name\n   *\n   * @param modelName - The name of the model to find\n   * @returns The model configuration or the first model if no name is provided\n   */\n  getModel(modelName?: string): string {\n    const firstModel = this.config?.models?.[0];\n\n    if (!this.config.models || !firstModel) {\n      throw new Error(\"No models available in assistant configuration\");\n    }\n\n    if (!modelName) {\n      return firstModel.model;\n    }\n\n    // Look for a model matching the provided name\n    const model = this.config.models.find(\n      (m) =>\n        m?.model === modelName ||\n        m?.model.includes(modelName) ||\n        m?.model.endsWith(`/${modelName}`),\n    );\n\n    if (!model) {\n      throw new Error(\n        `Model ${modelName} not found in assistant configuration`,\n      );","sourceCodeStart":15,"sourceCodeEnd":51,"githubUrl":"https://github.com/continuedev/continue/blob/5522c6f44ca0ac3528b37244818fbfa39b5af470/packages/continue-sdk/typescript/src/Assistant.ts#L15-L51","documentation":"Assistant.getModel throws when the assistant configuration has no models array or an empty one, so there is no default model to return when modelName is omitted.","triggerScenarios":"Calling assistant.getModel() (no argument) on an Assistant whose config.models is undefined, null, or [].","commonSituations":"Loading a hub assistant whose config failed to populate models, using Assistant.mock() or a partially-built config, or constructing Assistant manually without models.","solutions":["Check config.models exists and is non-empty before calling getModel","Pass an explicit model name if you have one, though the first-model path is what fails here","Fix the source of the assistant config so models are actually loaded (check hub fetch / mock setup)","Fall back to a default model list when the config is empty"],"exampleFix":"// before\nconst model = assistant.getModel();\n\n// after\nconst model = assistant.config?.models?.length\n  ? assistant.getModel()\n  : 'anthropic/claude-sonnet-4-5';","handlingStrategy":"type-guard","validationCode":"if (!assistant.config?.models?.length) throw new Error('assistant has no models');","typeGuard":"function assistantHasModels(a: { config?: { models?: unknown[] } }): a is { config: { models: [unknown, ...unknown[] } } { return Array.isArray(a.config?.models) && a.config.models.length > 0; }","tryCatchPattern":"try { model = assistant.getModel(); } catch (e) { if (e.message.includes('No models available')) model = DEFAULT_MODEL; else throw e; }","preventionTips":["Verify config.models is non-empty after loading an assistant","Provide a fallback default model","Check hub fetch succeeded before using the Assistant"],"tags":["continue-sdk","assistant","models","config"],"backgroundTag":"empty-model-config","analyzedSha":"5522c6f44ca0ac3528b37244818fbfa39b5af470","analyzedAt":"2026-08-27T11:28:54.683Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}