mudler/LocalAI · error
router/rerank: reranker is required (configure router.classi
Error message
router/rerank: reranker is required (configure router.classifier_model)
What it means
Construction-time panic in NewRerankClassifier: policies were supplied but the reranker backend handle is nil. The reranker (configured via router.classifier_model) is the cross-encoder the classifier delegates scoring to; without it there is no way to rank policies, so construction aborts.
Source
Thrown at core/services/routing/router/rerank.go:44
// budget trims the query to the reranker model's context minus the
// longest policy description (paired with the query per rerank call);
// nil reranks Probe.Prompt as built by the caller.
budget *lazyBudget
}
// defaultRerankActivationThreshold is the relevance floor a label
// must clear to be considered active. Reranker scores live in [0, 1]
// for cross-encoder / ColBERT heads; 0.5 picks "more positive than
// not on this label."
const defaultRerankActivationThreshold = 0.5
func NewRerankClassifier(policies []ScorePolicy, reranker backend.Reranker, cacheCap int, activationThreshold float64) *RerankClassifier {
if len(policies) == 0 {
panic("router/rerank: at least one policy is required")
}
if reranker == nil {
panic("router/rerank: reranker is required (configure router.classifier_model)")
}
for _, p := range policies {
if p.Label == "" {
panic("router/rerank: policy has empty label")
}
if p.Description == "" {
panic(fmt.Sprintf("router/rerank: policy %q has no description", p.Label))
}
}
if activationThreshold <= 0 {
activationThreshold = defaultRerankActivationThreshold
}
labels := make([]string, len(policies))
docs := make([]string, len(policies))
for i, p := range policies {
labels[i] = p.Label
docs[i] = p.Description
}View on GitHub (pinned to 44413a9d06)
Solutions
- Set router.classifier_model in config to a model that provides rerank embeddings/scores (e.g. a cross-encoder)
- Verify the named model exists and loaded successfully (check model list / logs at startup)
- Ensure the referenced backend implements backend.Reranker (a rerank-capable model, not a plain LLM)
- Fix construction order so the reranker handle is resolved before the router is assembled
Example fix
# before (yaml)
router:
classifier:
type: rerank
policies: [...]
# after
router:
classifier_model: rerank- ms-marco-minilm # model id with rerank capability
classifier:
type: rerank
policies: [...] Defensive patterns
Strategy: validation
Validate before calling
reranker, err := resolveModel(cfg.Router.ClassifierModel)
if err != nil || reranker == nil {
return fmt.Errorf("router: classifier_model %q not loaded", cfg.Router.ClassifierModel)
} Type guard
func implementsReranker(m backend.Backend) bool { _, ok := m.(backend.Reranker); return ok } Prevention
- Install and verify the reranker model before enabling the classifier
- Assert the resolved model implements backend.Reranker during router assembly
- Fail config load when classifier is enabled without classifier_model
When it happens
Trigger: Router config sets a rerank classifier with policies but router.classifier_model is unset/empty, or the named model failed to load so the loader passed nil; calling NewRerankClassifier(policies, nil, ...) directly.
Common situations: Enabling the classifier before pulling/installing the reranker model; classifier_model name typo so model resolution returns nil; the classifier model backend lacking rerank capability; ordering issue where the router is built before models are registered.
Related errors
- router/score: scorer is required (configure router.classifie
- router/rerank: at least one policy is required
- router/rerank: policy has empty label
- router/rerank: policy %q has no description
- router/score: at least one policy is required
AI-assisted analysis of mudler/LocalAI@44413a9d06 (2026-08-15).
Data as JSON: /api/errors/e89823c25e299be3.
Report an issue: GitHub.