{"record":{"id":"1d89dc40c751e870","repo":"Tencent/WeKnora","slug":"source-chunk-id-s-not-found-in-mapping","errorCode":null,"errorMessage":"source chunk ID %s not found in mapping","messagePattern":"source chunk ID (.+?) not found in mapping","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/application/repository/retriever/elasticsearch/v7/repository.go","lineNumber":1178,"sourceCode":"\n\t// Get document source\n\tsourceObj, ok := hitMap[\"_source\"].(map[string]interface{})\n\tif !ok {\n\t\tlog.Warnf(\"[ElasticsearchV7] Hit missing _source field\")\n\t\treturn nil, nil, fmt.Errorf(\"hit missing _source field\")\n\t}\n\n\t// Get source ChunkID and corresponding target ChunkID\n\tsourceChunkID, ok := sourceObj[\"chunk_id\"].(string)\n\tif !ok {\n\t\tlog.Warnf(\"[ElasticsearchV7] Source index data missing chunk_id field\")\n\t\treturn nil, nil, fmt.Errorf(\"source index data missing chunk_id field\")\n\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)","sourceCodeStart":1160,"sourceCodeEnd":1196,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/application/repository/retriever/elasticsearch/v7/repository.go#L1160-L1196","documentation":"Elasticsearch v7 reindex mapping miss: the hit's source chunk_id is present but absent from the source-to-target chunk ID map built for this copy operation, so there is no destination to write the document to and the hit is rejected as unmappable.","triggerScenarios":"Thrown at internal/application/repository/retriever/elasticsearch/v7/repository.go:1178 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure the copy mapping covers all chunks in the source index","Check for newly created chunks after the mapping was built","Skip unmapped hits and reconcile them in a follow-up 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"}