{"record":{"id":"683d4409a39eed9a","repo":"Tencent/WeKnora","slug":"embedding-model-id-is-required-for-rag-compression","errorCode":null,"errorMessage":"embedding_model_id is required for RAG compression","messagePattern":"embedding_model_id is required for RAG compression","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/application/service/web_search.go","lineNumber":157,"sourceCode":"\treturn base\n}\n\n// CompressWithRAG performs RAG-based compression using a temporary, hidden knowledge base.\n// The temporary knowledge base is deleted after use. The UI will not list it due to repo filtering.\nfunc (s *WebSearchService) CompressWithRAG(\n\tctx context.Context, sessionID string, tempKBID string, questions []string,\n\twebSearchResults []*types.WebSearchResult, cfg *types.WebSearchConfig,\n\tkbSvc interfaces.KnowledgeBaseService, knowSvc interfaces.KnowledgeService,\n\tseenURLs map[string]bool, knowledgeIDs []string,\n) (compressed []*types.WebSearchResult, kbID string, newSeen map[string]bool, newIDs []string, err error) {\n\tif len(webSearchResults) == 0 || len(questions) == 0 {\n\t\treturn\n\t}\n\tif cfg == nil {\n\t\treturn nil, tempKBID, seenURLs, knowledgeIDs, fmt.Errorf(\"web search config is required for RAG compression\")\n\t}\n\tif cfg.EmbeddingModelID == \"\" {\n\t\treturn nil, tempKBID, seenURLs, knowledgeIDs, fmt.Errorf(\"embedding_model_id is required for RAG compression\")\n\t}\n\tvar createdKB *types.KnowledgeBase\n\t// reuse or create temp KB\n\tif strings.TrimSpace(tempKBID) != \"\" {\n\t\tcreatedKB, err = kbSvc.GetKnowledgeBaseByID(ctx, tempKBID)\n\t\tif err != nil {\n\t\t\tlogger.Warnf(ctx, \"Temp KB %s not available, recreating: %v\", tempKBID, err)\n\t\t\tcreatedKB = nil\n\t\t}\n\t}\n\tif createdKB == nil {\n\t\tkb := &types.KnowledgeBase{\n\t\t\tName:             fmt.Sprintf(\"tmp-websearch-%d\", time.Now().UnixNano()),\n\t\t\tDescription:      \"Ephemeral search compression KB\",\n\t\t\tIsTemporary:      true,\n\t\t\tEmbeddingModelID: cfg.EmbeddingModelID,\n\t\t}\n\t\tcreatedKB, err = kbSvc.CreateKnowledgeBase(ctx, kb)","sourceCodeStart":139,"sourceCodeEnd":175,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/application/service/web_search.go#L139-L175","documentation":"Configuration guard in CompressWithRAG: RAG compression embeds and retrieves via a specific embedding model, and cfg.EmbeddingModelID is empty, so there is no model to vectorize the web search results with. Configure an embedding model before enabling RAG compression of search results.","triggerScenarios":"Thrown at internal/application/service/web_search.go:157 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set embedding_model_id in the web search config","Verify the embedding model selection was saved with the provider config","Choose a valid embedding model available to the tenant"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"988cbb03305e055d8ebb7d46d9ac6cc0803cd074","analyzedAt":"2026-09-02T14:41:08.344Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}