Tencent/WeKnora · error

model not found

Error message

model not found

What it means

Sentinel ErrModelNotFound returned by model service getters (GetModel, UpdateModel, delete paths) when the repository returns nil for the model id — no model config row exists. Distinguishes missing config from lookup errors; handlers map it to 404.

Source

Thrown at internal/application/service/model.go:24

	"fmt"
	"strings"

	apperrors "github.com/Tencent/WeKnora/internal/errors"
	"github.com/Tencent/WeKnora/internal/logger"
	"github.com/Tencent/WeKnora/internal/models/asr"
	"github.com/Tencent/WeKnora/internal/models/chat"
	"github.com/Tencent/WeKnora/internal/models/embedding"
	"github.com/Tencent/WeKnora/internal/models/provider"
	"github.com/Tencent/WeKnora/internal/models/rerank"
	"github.com/Tencent/WeKnora/internal/models/utils/ollama"
	"github.com/Tencent/WeKnora/internal/models/vlm"
	"github.com/Tencent/WeKnora/internal/types"
	"github.com/Tencent/WeKnora/internal/types/interfaces"
	"github.com/Tencent/WeKnora/internal/utils"
)

// ErrModelNotFound is returned when a model cannot be found in the repository
var ErrModelNotFound = errors.New("model not found")

// modelService implements the model service interface
type modelService struct {
	repo          interfaces.ModelRepository
	kbRepo        interfaces.KnowledgeBaseRepository
	agentRepo     interfaces.CustomAgentRepository
	ollamaService *ollama.OllamaService
	pooler        embedding.EmbedderPooler
	tenantService interfaces.TenantService
}

// NewModelService creates a new model service instance
func NewModelService(repo interfaces.ModelRepository,
	kbRepo interfaces.KnowledgeBaseRepository,
	agentRepo interfaces.CustomAgentRepository,
	ollamaService *ollama.OllamaService,
	pooler embedding.EmbedderPooler,
	tenantService interfaces.TenantService,

View on GitHub (pinned to 988cbb0330)

Solutions

  1. Verify the model id; it may have been deleted or belong to another tenant
  2. Create/register the model config before referencing it
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at internal/application/service/model.go:24 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Tencent/WeKnora@988cbb0330 (2026-09-02). Data as JSON: /api/errors/26525a45ff7a576f. Report an issue: GitHub.