Tencent/WeKnora · error
model is not active
Error message
model is not active
What it means
GetEmbeddingModelForTenant only serves models whose status is exactly types.ModelStatusActive. Unlike GetModelByID, it does not distinguish downloading/failed — any non-active status returns errors.New("model is not active"), because a cross-tenant embedder must be fully ready to guarantee vector compatibility. It can also be transient (still downloading) or permanent (download failed/disabled).
Source
Thrown at internal/application/service/model.go:539
// Fetch model from repository using the specified tenant ID
model, err := s.repo.GetByID(ctx, tenantID, modelId)
if err != nil {
logger.ErrorWithFields(ctx, err, map[string]interface{}{
"model_id": modelId,
"tenant_id": tenantID,
})
return nil, err
}
if model == nil {
logger.Error(ctx, "Model not found for specified tenant")
return nil, ErrModelNotFound
}
if model.Status != types.ModelStatusActive {
logger.Errorf(ctx, "Model is not active, status: %s", model.Status)
return nil, errors.New("model is not active")
}
logger.Infof(ctx, "Getting cross-tenant embedding model: %s, source: %s, tenant: %d", model.Name, model.Source, tenantID)
appID, appSecret := s.resolveWeKnoraCloudCredentials(ctx, &model.Parameters)
embedder, err := embedding.NewEmbedder(embedding.ConfigFromModel(model, appID, appSecret), s.pooler, s.ollamaService)
if err != nil {
logger.ErrorWithFields(ctx, err, map[string]interface{}{
"model_id": model.ID,
"model_name": model.Name,
"tenant_id": tenantID,
})
return nil, err
}
logger.Info(ctx, "Cross-tenant embedding model initialized successfully")
return embedder, nilView on GitHub (pinned to 988cbb0330)
Solutions
- Check the source-tenant model's status (admin UI or GetModelByID) to see whether it is downloading or failed/disabled, and wait for it to become active or fix the underlying download failure.
- If the model was intentionally disabled, re-enable it or update the shared knowledge base to use a different active embedding model.
- Re-trigger the model download if it is in a failed state, then retry once status is active.
- Add a retry-with-backoff for the transient downloading case, and alert on permanently non-active models referenced by active cross-tenant shares.
Example fix
// before
embedder, err := modelService.GetEmbeddingModelForTenant(ctx, modelID, sourceTenantID)
// after
for i := 0; i < 12; i++ {
embedder, err = modelService.GetEmbeddingModelForTenant(ctx, modelID, sourceTenantID)
if err == nil { break }
time.Sleep(15 * time.Second) // transient "model is not active" while downloading
} Defensive patterns
Strategy: retry
Validate before calling
m, err := svc.GetModelByID(ctx, modelID)
if err == nil && m.Status != types.ModelStatusActive {
// wait or repair before cross-tenant use
} Type guard
func isActiveModel(m *types.Model) bool { return m != nil && m.Status == types.ModelStatusActive } Try / catch
embedder, err := svc.GetEmbeddingModelForTenant(ctx, modelID, tenantID)
if err != nil {
if strings.Contains(err.Error(), "model is not active") {
// check whether transient (downloading) or permanent (failed/disabled)
}
return nil, err
} Prevention
- Verify source-tenant model status is active before creating cross-tenant shares.
- Re-check status after model re-provisioning or admin disable actions.
- Alert when active shares reference non-active models.
- Only retry when the underlying state is transient (downloading), not when disabled/failed.
When it happens
Trigger: Calling GetEmbeddingModelForTenant for a model whose Status is anything other than ModelStatusActive — still downloading, download failed, disabled, or deleted — typically right after provisioning a model or after it was disabled in the target tenant.
Common situations: Cross-tenant KB sharing references a source-tenant embedding model that was just created and has not finished downloading; the model was disabled/deactivated by an admin after sharing was set up; the model row failed download earlier; status changed between when the share was created and when it is used.
Related errors
- model ID cannot be empty
- model is currently downloading
- model download failed
- abnormal model status
- unknown credential field:
AI-assisted analysis of Tencent/WeKnora@988cbb0330 (2026-09-02).
Data as JSON: /api/errors/e893a0e6cf51ca5f.
Report an issue: GitHub.