{"record":{"id":"1a056d3c89efe164","repo":"musistudio/claude-code-router","slug":"no-available-models-configure-at-least-one-provid","errorCode":null,"errorMessage":"No available models. Configure at least one provider with a model before starting CCR Gateway or opening an agent through CCR.","messagePattern":"No available models\\. Configure at least one provider with a model before starting CCR Gateway or opening an agent through CCR\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/core/src/contracts/app.ts","lineNumber":1121,"sourceCode":"  displayName: string;\n  enabled: boolean;\n  execution: VirtualModelExecutionConfig;\n  id: string;\n  instructions?: VirtualModelInstructionsConfig;\n  key: string;\n  match: VirtualModelMatchConfig;\n  materialization: VirtualModelMaterializationConfig;\n  metadata?: Record<string, unknown>;\n  toolChoice?: unknown;\n  tools: VirtualModelToolConfig[];\n};\n\nexport const NO_AVAILABLE_GATEWAY_MODELS_MESSAGE =\n  \"No available models. Configure at least one provider with a model before starting CCR Gateway or opening an agent through CCR.\";\n\nexport function assertAvailableGatewayModels(config: Pick<AppConfig, \"Providers\" | \"virtualModelProfiles\">): void {\n  if (!hasAvailableGatewayModels(config)) {\n    throw new Error(NO_AVAILABLE_GATEWAY_MODELS_MESSAGE);\n  }\n}\n\nexport function hasAvailableGatewayModels(config: Pick<AppConfig, \"Providers\" | \"virtualModelProfiles\">): boolean {\n  return availableGatewayModelIds(config).length > 0;\n}\n\nexport function availableGatewayModelIds(config: Pick<AppConfig, \"Providers\" | \"virtualModelProfiles\">): string[] {\n  const baseEntries = availableGatewayBaseModelEntries(config.Providers);\n  const ids = baseEntries.map((entry) => `${entry.providerName}/${entry.modelName}`);\n\n  for (const profile of config.virtualModelProfiles ?? []) {\n    if (!isGatewayModelVisibleVirtualProfile(profile)) {\n      continue;\n    }\n\n    for (const entry of baseEntries) {\n      for (const prefix of profile.match?.prefixes ?? []) {","sourceCodeStart":1103,"sourceCodeEnd":1139,"githubUrl":"https://github.com/musistudio/claude-code-router/blob/99f24806c6a2c660b16e53e95211c517448a6c90/packages/core/src/contracts/app.ts#L1103-L1139","documentation":"assertAvailableGatewayModels throws NO_AVAILABLE_GATEWAY_MODELS_MESSAGE when availableGatewayModelIds(config) returns an empty list — i.e. no configured provider exposes at least one model and no virtual model profile supplies one. It guards gateway startup and agent open paths so users fail fast instead of getting a gateway with zero routable models.","triggerScenarios":"Calling assertAvailableGatewayModels with an AppConfig whose Providers all have empty model lists (or no Providers at all) and no virtualModelProfiles with models; typically invoked before starting CCR Gateway or opening an agent.","commonSituations":"Fresh install with no provider configured; provider entries created but models array left empty; importing a config that dropped model definitions; all providers disabled/removed while profiles remain.","solutions":["Add at least one model to a configured provider (e.g. set models: [\"gpt-4o\"] or the provider's equivalent) in the Providers config","Alternatively define a virtualModelProfiles entry that maps an available model","Verify provider config was loaded (check the config file the app actually reads) and that provider is enabled","Use hasAvailableGatewayModels(config) in UI flows to disable gateway start instead of throwing"],"exampleFix":"// before\nassertAvailableGatewayModels(config); // throws\n// after\nconfig.Providers[0].models = [\"claude-sonnet-4\"];\nassertAvailableGatewayModels(config);","handlingStrategy":"validation","validationCode":"if (!hasAvailableGatewayModels(config)) { /* prompt user to add a provider+model instead of starting */ }","typeGuard":"import { hasAvailableGatewayModels } from \"@scope/core/contracts/app\";\nconst canStart = (c: AppConfig) => hasAvailableGatewayModels(c);","tryCatchPattern":null,"preventionTips":["Gate the Gateway start button on hasAvailableGatewayModels(config)","Show onboarding until at least one provider model exists"],"tags":["gateway","config","models","provider"],"backgroundTag":"empty-provider-configuration","analyzedSha":"99f24806c6a2c660b16e53e95211c517448a6c90","analyzedAt":"2026-08-27T04:11:01.184Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}