{"record":{"id":"875fba51d09638e8","repo":"Tencent/WeKnora","slug":"empty-embedding-vector-for-chunk-id-s","errorCode":null,"errorMessage":"empty embedding vector for chunk ID: %s","messagePattern":"empty embedding vector for chunk ID: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/application/repository/retriever/elasticsearch/v8/repository.go","lineNumber":167,"sourceCode":"\tlogger.GetLogger(ctx).Infof(\n\t\t\"[Elasticsearch] Storage size for %d indices: %d bytes\", len(indexInfoList), totalStorageSize,\n\t)\n\treturn totalStorageSize\n}\n\n// Save stores a single index document in Elasticsearch\n// Returns an error if the operation fails\nfunc (e *elasticsearchRepository) Save(ctx context.Context,\n\tembedding *typesLocal.IndexInfo,\n\tadditionalParams map[string]any,\n) error {\n\tlog := logger.GetLogger(ctx)\n\tlog.Debugf(\"[Elasticsearch] Saving index for chunk ID: %s\", embedding.ChunkID)\n\n\t// Convert to database format\n\tembeddingDB := elasticsearchRetriever.ToDBVectorEmbedding(embedding, additionalParams)\n\tif len(embeddingDB.Embedding) == 0 {\n\t\terr := fmt.Errorf(\"empty embedding vector for chunk ID: %s\", embedding.ChunkID)\n\t\tlog.Errorf(\"[Elasticsearch] %v\", err)\n\t\treturn err\n\t}\n\n\t// Index the document\n\tresp, err := e.client.Index(e.index).Request(embeddingDB).Do(ctx)\n\tif err != nil {\n\t\tlog.Errorf(\"[Elasticsearch] Failed to save index: %v\", err)\n\t\treturn err\n\t}\n\n\tlog.Infof(\"[Elasticsearch] Successfully saved index for chunk ID: %s, document ID: %s\", embedding.ChunkID, resp.Id_)\n\treturn nil\n}\n\n// BatchSave stores multiple index documents in Elasticsearch using bulk API\n// Returns an error if the operation fails\nfunc (e *elasticsearchRepository) BatchSave(ctx context.Context,","sourceCodeStart":149,"sourceCodeEnd":185,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/application/repository/retriever/elasticsearch/v8/repository.go#L149-L185","documentation":"Elasticsearch v8 save guard: the converted embedding document for the chunk carries a zero-length vector, meaning the chunk was indexed without an embedding (embedding failure upstream or unsupported content), and the save is rejected because ES cannot index an empty dense vector.","triggerScenarios":"Thrown at internal/application/repository/retriever/elasticsearch/v8/repository.go:167 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the embedding pipeline produced a vector for this chunk","Skip non-embeddable chunks instead of saving them","Check embedding dimension/model configuration"],"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"}