{"record":{"id":"28c2f91a0e82122b","repo":"Tencent/WeKnora","slug":"failed-to-get-chat-model-w","errorCode":null,"errorMessage":"failed to get chat model: %w","messagePattern":"failed to get chat model: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/application/service/knowledge_process.go","lineNumber":1610,"sourceCode":"\ttotalTextChunks = len(textChunks)\n\n\tif len(textChunks) == 0 {\n\t\texitStatus = \"no_text_chunks\"\n\t\tlogger.Infof(ctx, \"No text chunks found for knowledge: %s\", payload.KnowledgeID)\n\t\treturn nil\n\t}\n\n\t// Sort chunks by StartAt for context building\n\tsort.Slice(textChunks, func(i, j int) bool {\n\t\treturn textChunks[i].StartAt < textChunks[j].StartAt\n\t})\n\n\t// Initialize chat model\n\tchatModel, err := s.modelService.GetChatModel(ctx, kb.SummaryModelID)\n\tif err != nil {\n\t\texitStatus = \"get_chat_model_failed\"\n\t\tlogger.Errorf(ctx, \"Failed to get chat model: %v\", err)\n\t\treturn fmt.Errorf(\"failed to get chat model: %w\", err)\n\t}\n\tresolvedModelID = kb.SummaryModelID\n\n\t// Initialize embedding model and retrieval engine\n\tembeddingModel, err := s.modelService.GetEmbeddingModel(ctx, kb.EmbeddingModelID)\n\tif err != nil {\n\t\texitStatus = \"get_embedding_model_failed\"\n\t\tlogger.Errorf(ctx, \"Failed to get embedding model: %v\", err)\n\t\treturn fmt.Errorf(\"failed to get embedding model: %w\", err)\n\t}\n\n\ttenantInfo, err := s.tenantRepo.GetTenantByID(ctx, payload.TenantID)\n\tif err != nil {\n\t\texitStatus = \"get_tenant_failed\"\n\t\tlogger.Errorf(ctx, \"Failed to get tenant info: %v\", err)\n\t\treturn fmt.Errorf(\"failed to get tenant info: %w\", err)\n\t}\n\tctx = context.WithValue(ctx, types.TenantInfoContextKey, tenantInfo)","sourceCodeStart":1592,"sourceCodeEnd":1628,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/application/service/knowledge_process.go#L1592-L1628","documentation":"Thrown by processQuestionGenerationForKnowledge when modelService.GetChatModel fails to resolve the chat model (kb.SummaryModelID) used to generate auxiliary questions for chunks. Fires on missing/disabled model config or provider errors; the stage aborts before any LLM calls.","triggerScenarios":"Thrown at internal/application/service/knowledge_process.go:1610 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the KB's summary model exists and is enabled for the tenant","Check model provider credentials and quotas","Retry question generation after fixing model configuration"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"988cbb03305e055d8ebb7d46d9ac6cc0803cd074","analyzedAt":"2026-09-02T14:41:08.344Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}