{"record":{"id":"395b31b21eedd428","repo":"Tencent/WeKnora","slug":"failed-to-create-temporary-knowledge-base-w","errorCode":null,"errorMessage":"failed to create temporary knowledge base: %w","messagePattern":"failed to create temporary knowledge base: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/application/service/web_search.go","lineNumber":177,"sourceCode":"\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)\n\t\tif err != nil {\n\t\t\treturn nil, tempKBID, seenURLs, knowledgeIDs, fmt.Errorf(\n\t\t\t\t\"failed to create temporary knowledge base: %w\",\n\t\t\t\terr,\n\t\t\t)\n\t\t}\n\t\ttempKBID = createdKB.ID\n\t}\n\n\t// Ingest all web results as passages synchronously\n\t// dedupe by URL across queries within the same temp KB for this request/session\n\tif seenURLs == nil {\n\t\tseenURLs = map[string]bool{}\n\t}\n\tfor _, r := range webSearchResults {\n\t\tsourceURL := r.URL\n\t\ttitle := strings.TrimSpace(r.Title)\n\t\tsnippet := strings.TrimSpace(r.Snippet)\n\t\tbody := strings.TrimSpace(r.Content)\n\t\t// skip if already ingested for this KB","sourceCodeStart":159,"sourceCodeEnd":195,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/application/service/web_search.go#L159-L195","documentation":"CreateKnowledgeBase for the ephemeral 'tmp-websearch-*' compression KB failed. Without the temp KB the RAG compression pipeline cannot ingest search results and must abort (an existing tempKBID that vanished is already tolerated with a recreate attempt).","triggerScenarios":"Thrown at internal/application/service/web_search.go:177 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the knowledge base service/DB availability","Verify the embedding model ID resolves to an existing model","Retry compression; the temp KB is recreated on the next attempt"],"exampleFix":null,"handlingStrategy":"try-catch","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"}