{"record":{"id":"1712af7a987f98e3","repo":"Tencent/WeKnora","slug":"source-knowledge-id-s-not-found-in-mapping","errorCode":null,"errorMessage":"source knowledge ID %s not found in mapping","messagePattern":"source knowledge ID (.+?) not found in mapping","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/application/repository/retriever/elasticsearch/v7/repository.go","lineNumber":1191,"sourceCode":"\t}\n\n\ttargetChunkID, ok := sourceToTargetChunkIDMap[sourceChunkID]\n\tif !ok {\n\t\tlog.Warnf(\"[ElasticsearchV7] Source chunk ID %s not found in mapping\", sourceChunkID)\n\t\treturn nil, nil, fmt.Errorf(\"source chunk ID %s not found in mapping\", sourceChunkID)\n\t}\n\n\t// Get mapped target knowledge ID\n\tsourceKnowledgeID, ok := sourceObj[\"knowledge_id\"].(string)\n\tif !ok {\n\t\tlog.Warnf(\"[ElasticsearchV7] Source index data missing knowledge_id field\")\n\t\treturn nil, nil, fmt.Errorf(\"source index data missing knowledge_id field\")\n\t}\n\n\ttargetKnowledgeID, ok := sourceToTargetKBIDMap[sourceKnowledgeID]\n\tif !ok {\n\t\tlog.Warnf(\"[ElasticsearchV7] Source knowledge ID %s not found in mapping\", sourceKnowledgeID)\n\t\treturn nil, nil, fmt.Errorf(\"source knowledge ID %s not found in mapping\", sourceKnowledgeID)\n\t}\n\n\t// Extract basic content\n\tcontent, _ := sourceObj[\"content\"].(string)\n\toriginalSourceID, _ := sourceObj[\"source_id\"].(string)\n\tsourceType := 0\n\tif st, ok := sourceObj[\"source_type\"].(float64); ok {\n\t\tsourceType = int(st)\n\t}\n\n\t// Extract is_enabled (default true for backward compatibility)\n\tisEnabled := true\n\tif v, ok := sourceObj[\"is_enabled\"].(bool); ok {\n\t\tisEnabled = v\n\t}\n\n\t// Extract is_recommended\n\tisRecommended := false","sourceCodeStart":1173,"sourceCodeEnd":1209,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/application/repository/retriever/elasticsearch/v7/repository.go#L1173-L1209","documentation":"Elasticsearch v7 reindex mapping miss: the hit's knowledge_id is present but not found in the source-to-target KB ID map, so the document has no destination knowledge base in the copy operation and the hit is rejected as unmappable.","triggerScenarios":"Thrown at internal/application/repository/retriever/elasticsearch/v7/repository.go:1191 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure the KB mapping covers all knowledge IDs present in the source index","Rebuild the mapping if documents were added after it was computed","Skip and reconcile unmapped documents in a later pass"],"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"}