Tencent/WeKnora · error
rerank model is not configured: please set rerank_model_id o
Error message
rerank model is not configured: please set rerank_model_id on the agent
What it means
When the agent has the knowledge_search tool enabled, AgentQA requires a rerank model. It reads req.CustomAgent.Config.RerankModelID; if the agent needs reranking (agentRequiresRerankModel) and the field is empty, this error is returned before retrieval. Wiki-only agents that don't need reranking are exempt.
Source
Thrown at internal/application/service/session_agent_qa.go:111
// Get rerank model from custom agent config only when knowledge_search can
// actually run. A disabled KB scope makes all KB tools ineffective, so it
// must not force users to configure an otherwise-unused rerank model.
var rerankModel rerank.Reranker
if agentRequiresRerankModel(req.CustomAgent) {
// Rerank model is resolved purely from the agent config now.
// We used to fall back to ConversationConfig.RerankModelID at
// the tenant level, but that path encouraged "leave rerank
// blank on the agent and inherit silently" which made debugging
// retrieval quality a guessing game across tenant settings vs
// agent settings. Forcing the agent to declare its own rerank
// model puts the configuration where the user actually edits
// the agent. If a Wiki-only agent doesn't need reranking,
// agentRequiresRerankModel() below already lets it pass.
rerankModelID := req.CustomAgent.Config.RerankModelID
if rerankModelID == "" {
logger.Warnf(ctx, "No rerank model configured for custom agent %s, but knowledge_search tool is enabled", req.CustomAgent.ID)
return errors.New("rerank model is not configured: please set rerank_model_id on the agent")
}
rerankModel, err = s.modelService.GetRerankModel(ctx, rerankModelID)
if err != nil {
logger.Warnf(ctx, "Failed to get rerank model: %v", err)
return fmt.Errorf("failed to get rerank model: %w", err)
}
} else {
logger.Infof(ctx, "knowledge_search is unavailable for the effective agent scope, skipping rerank model initialization")
}
// Load multi-turn history directly from DB (the single source of truth).
// AgentSteps on each historical assistant message are expanded into proper
// assistant_with_tool_calls + tool messages so the model can see what was
// tried last turn — except final_answer, which is replayed as the trailing
// canonical assistant message.
var llmContext []chat.Message
if agentConfig.MultiTurnEnabled {View on GitHub (pinned to 988cbb0330)
Solutions
- Set rerank_model_id on the agent's config to a valid rerank model ID.
- Alternatively disable the knowledge_search tool if reranking is not needed.
- Validate via modelService.GetRerankModel that the configured rerank model exists.
Example fix
// before
cfg := &types.AgentConfig{Tools: []string{"knowledge_search"}} // no RerankModelID
// after
cfg := &types.AgentConfig{Tools: []string{"knowledge_search"}, RerankModelID: "bge-reranker-v2-m3"} Defensive patterns
Strategy: validation
Validate before calling
if slices.Contains(agent.Config.Tools, "knowledge_search") && agent.Config.RerankModelID == "" {
return fmt.Errorf("agent %s enables knowledge_search but has no rerank_model_id", agent.ID)
} Type guard
func needsRerankModel(a *types.CustomAgent) bool {
return slices.Contains(a.Config.Tools, "knowledge_search") && a.Config.RerankModelID == ""
} Prevention
- Enforce rerank_model_id when knowledge_search is enabled, at save time.
- Verify the rerank model exists via GetRerankModel after cloning/importing agents.
- Disable knowledge_search instead of leaving rerank unconfigured.
When it happens
Trigger: Calling AgentQA with a CustomAgent that enables the knowledge_search tool but leaves Config.RerankModelID empty.
Common situations: Agents enabled for knowledge search after creation without adding a rerank model, cloned agents whose rerank_model_id was not copied, or rerank model removed from the registry while the field was cleared.
Understand the failure class
Background: "X is required", "must be set", "cannot be empty": the missing-required-config error family, from Vertex AI project/location to WeChat keys — this error's family across 18 libraries.
Related errors
- custom agent configuration is required for agent QA
- summary model (model_id) is not configured in custom agent s
- invalid sandbox type
- timeout cannot be negative
- memory limit cannot be negative
AI-assisted analysis of Tencent/WeKnora@988cbb0330 (2026-09-02).
Data as JSON: /api/errors/a092b9ae9e0380ca.
Report an issue: GitHub.