Tencent/WeKnora · error
abnormal model status
Error message
abnormal model status
What it means
This is the catch-all branch of GetModelByID's status checks: if the model's status is not Active, Downloading, or DownloadFailed, the service treats the row as corrupt/unknown and returns errors.New("abnormal model status"). It guards against unknown or invalid enum values in model.Status (e.g. empty string, legacy value, or data written by a newer/older version).
Source
Thrown at internal/application/service/model.go:203
logger.Infof(ctx, "Model found, name: %s, status: %s", model.Name, model.Status)
// Check model status
if model.Status == types.ModelStatusActive {
return model, nil
}
if model.Status == types.ModelStatusDownloading {
logger.Warn(ctx, "Model is currently downloading")
return nil, errors.New("model is currently downloading")
}
if model.Status == types.ModelStatusDownloadFailed {
logger.Error(ctx, "Model download failed")
return nil, errors.New("model download failed")
}
logger.Error(ctx, "Model status is abnormal")
return nil, errors.New("abnormal model status")
}
// ListModels returns all models belonging to the tenant
func (s *modelService) ListModels(ctx context.Context) ([]*types.Model, error) {
logger.Info(ctx, "Start listing models")
tenantID := types.MustTenantIDFromContext(ctx)
logger.Infof(ctx, "Listing models for tenant ID: %d", tenantID)
// List models from repository with no additional filters
models, err := s.repo.List(ctx, tenantID, "", "")
if err != nil {
logger.ErrorWithFields(ctx, err, map[string]interface{}{
"tenant_id": tenantID,
})
return nil, err
}
View on GitHub (pinned to 988cbb0330)
Solutions
- Query the model row in the database and inspect its status value; identify what out-of-range value was stored.
- Write a migration/repair to reset the invalid status to a valid value (e.g. re-download path or ModelStatusDownloadFailed) or delete and re-register the model.
- Confirm all service replicas run the same binary version, so the set of known statuses matches what is persisted.
- Harden the status enum mapping (e.g. a FromString parser that rejects unknown values at write time) so invalid statuses cannot be persisted again.
Example fix
// before (db row) // models.status = "provisionning" (typo / unknown value) // after UPDATE models SET status = 'download_failed' WHERE id = ?; -- then re-trigger download // or delete and re-register the model so it goes through the normal lifecycle
Defensive patterns
Strategy: type-guard
Validate before calling
validStatuses := map[string]bool{"active": true, "downloading": true, "download_failed": true}
if !validStatuses[m.Status] { /* repair row / re-register model */ } Type guard
func hasKnownStatus(m *types.Model, known map[string]bool) bool { return m != nil && known[m.Status] } Try / catch
model, err := svc.GetModelByID(ctx, modelID)
if err != nil {
if strings.Contains(err.Error(), "abnormal model status") {
return nil, fmt.Errorf("model %s has corrupt/unknown status; re-register it", modelID)
}
return nil, err
} Prevention
- Keep all service replicas on the same version so status enums match persisted data.
- Validate status values at write time with a strict parser.
- Avoid manual DB edits on model rows; use the provided lifecycle APIs.
- Add a data-integrity check/migration that flags out-of-range status values.
When it happens
Trigger: GetModelByID (or GetEmbeddingModel/GetRerankModel) fetches a model whose Status field holds a value outside the known set of types.ModelStatus* constants — e.g. empty status, a status added by a newer binary but persisted by an older one, or manually edited DB rows.
Common situations: Schema/version skew after upgrading the service while old rows retain legacy status strings; a migration bug that left status NULL/empty; manual database edits or an import script writing raw values; concurrent state machine bugs that set an undefined status.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- model ID cannot be empty
- model is currently downloading
- model download failed
- unknown credential field:
- model is not active
AI-assisted analysis of Tencent/WeKnora@988cbb0330 (2026-09-02).
Data as JSON: /api/errors/548222b668f6ffdb.
Report an issue: GitHub.