{"record":{"id":"07f0d6a94f26ac8e","repo":"Tencent/WeKnora","slug":"summary-model-model-id-is-not-configured-in-cust","errorCode":null,"errorMessage":"summary model (model_id) is not configured in custom agent settings","messagePattern":"summary model \\(model_id\\) is not configured in custom agent settings","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/application/service/session_agent_qa.go","lineNumber":85,"sourceCode":"\t// Build AgentConfig from custom agent and tenant info\n\tagentConfig, err := s.buildAgentConfig(ctx, req, tenantInfo, agentTenantID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Set VLM model ID for tool result image analysis (runtime-only field)\n\tif req.CustomAgent != nil && req.CustomAgent.Config.VLMModelID != \"\" {\n\t\tagentConfig.VLMModelID = req.CustomAgent.Config.VLMModelID\n\t}\n\n\t// Resolve model ID using shared helper (AgentQA requires a model, so error if not found)\n\teffectiveModelID, err := s.resolveChatModelID(ctx, req, agentConfig.KnowledgeBases, agentConfig.KnowledgeIDs)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif effectiveModelID == \"\" {\n\t\tlogger.Warnf(ctx, \"No summary model configured for custom agent %s\", req.CustomAgent.ID)\n\t\treturn errors.New(\"summary model (model_id) is not configured in custom agent settings\")\n\t}\n\n\tsummaryModel, err := s.modelService.GetChatModel(ctx, effectiveModelID)\n\tif err != nil {\n\t\tlogger.Warnf(ctx, \"Failed to get chat model: %v\", err)\n\t\treturn fmt.Errorf(\"failed to get chat model: %w\", err)\n\t}\n\n\t// Get rerank model from custom agent config only when knowledge_search can\n\t// actually run. A disabled KB scope makes all KB tools ineffective, so it\n\t// must not force users to configure an otherwise-unused rerank model.\n\tvar rerankModel rerank.Reranker\n\tif agentRequiresRerankModel(req.CustomAgent) {\n\t\t// Rerank model is resolved purely from the agent config now.\n\t\t// We used to fall back to ConversationConfig.RerankModelID at\n\t\t// the tenant level, but that path encouraged \"leave rerank\n\t\t// blank on the agent and inherit silently\" which made debugging\n\t\t// retrieval quality a guessing game across tenant settings vs","sourceCodeStart":67,"sourceCodeEnd":103,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/application/service/session_agent_qa.go#L67-L103","documentation":"AgentQA resolves an effective chat/summary model via resolveChatModelID (from the request, the agent's knowledge bases, or knowledge IDs). If resolution succeeds but returns an empty string, the custom agent has no model_id configured and QA cannot summarize retrieved context, so this error is returned.","triggerScenarios":"Calling AgentQA with a CustomAgent whose settings contain no model_id and whose knowledge bases/IDs do not imply a model.","commonSituations":"Agents created through an import/clone that dropped model_id, agents configured before a model was picked, model deleted from the model registry leaving the field blank, or fresh agents saved with incomplete settings.","solutions":["Set model_id in the custom agent's settings to a valid chat model ID.","Verify the referenced model exists via modelService.GetChatModel before invoking QA.","Attach the agent to knowledge bases that carry a default model, or pass the model explicitly in the request."],"exampleFix":"// before\nagent := &types.CustomAgent{ID: \"agent-1\", Config: cfg} // cfg has no ModelID\n// after\ncfg.ModelID = \"gpt-4o\" // or another valid chat model ID\nagent := &types.CustomAgent{ID: \"agent-1\", Config: cfg}","handlingStrategy":"validation","validationCode":"if agent.Config.ModelID == \"\" {\n    return fmt.Errorf(\"agent %s has no model_id configured\", agent.ID)\n}","typeGuard":"func hasChatModel(a *types.CustomAgent) bool { return a != nil && a.Config.ModelID != \"\" }","tryCatchPattern":null,"preventionTips":["Require model_id at agent save time; don't allow saving agents without one.","Check model existence via GetChatModel after imports/clones.","Alert on agents whose configured model was deleted from the registry."],"tags":["configuration","model","agent","go"],"backgroundTag":"missing-required-config","analyzedSha":"988cbb03305e055d8ebb7d46d9ac6cc0803cd074","analyzedAt":"2026-09-02T14:41:08.344Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}