Tencent/WeKnora · error
chunk query returned no data
Error message
chunk query returned no data
What it means
After authorize and chunk query succeed, if the chunk query returns a nil chunks slice the tool treats it as an abnormal empty result and fails with this error rather than rendering an empty page. It signals the data layer returned no data object at all for the requested knowledge item.
Source
Thrown at internal/agent/tools/list_knowledge_chunks.go:161
pagination := &types.Pagination{
Page: offset/chunkLimit + 1,
PageSize: chunkLimit,
}
enabled := true
chunks, total, err := t.chunkService.GetRepository().ListPagedChunksByKnowledgeID(ctx,
effectiveTenantID, knowledgeID, pagination, []types.ChunkType{types.ChunkTypeText, types.ChunkTypeFAQ}, nil, "", "", "", "", &enabled)
if err != nil {
return &types.ToolResult{
Success: false,
Error: fmt.Sprintf("failed to list chunks: %v", err),
}, err
}
if chunks == nil {
return &types.ToolResult{
Success: false,
Error: "chunk query returned no data",
}, fmt.Errorf("chunk query returned no data")
}
totalChunks := total
fetched := len(chunks)
// Explicit out-of-range guidance: when the caller paged past the end
// (offset >= total with total > 0), silently returning fetched=0 is
// confusing for LLMs that just saw the document in search results. Tell
// them exactly what happened and what offset would be valid so the next
// call lands on a real page.
if fetched == 0 && totalChunks > 0 && int64(offset) >= totalChunks {
suggestedOffset := totalChunks - int64(chunkLimit)
if suggestedOffset < 0 {
suggestedOffset = 0
}
return &types.ToolResult{
Success: false,
Error: fmt.Sprintf(View on GitHub (pinned to 988cbb0330)
Solutions
- Verify the knowledge item has completed ingestion (has chunks) before paging it
- Re-run or trigger the ingestion/indexing pipeline for the item
- Check backend storage connectivity/consistency for the knowledge service
- Handle it as 'no chunks exist yet' in the caller if empty results are acceptable
Example fix
// before
res, err := listChunks.Execute(ctx, {"knowledge_id": "kb-9"}) // kb-9 not yet indexed
// after
status := knowledgeService.GetIngestionStatus(ctx, "kb-9")
if status.Completed { res, err = listChunks.Execute(ctx, {"knowledge_id": "kb-9"}) } Defensive patterns
Strategy: validation
Validate before calling
status, err := knowledgeService.GetIngestionStatus(ctx, knowledgeID)
if err != nil || !status.Indexed {
return fmt.Errorf("knowledge %s not indexed yet", knowledgeID)
} Try / catch
res, err := tool.Execute(ctx, input)
if err != nil && strings.Contains(err.Error(), "chunk query returned no data") {
log.Printf("knowledge item has no chunks — check ingestion pipeline")
return emptyPageResult(), nil // treat as empty if acceptable
} Prevention
- Ensure ingestion/indexing completes before listing chunks
- Monitor the ingestion pipeline for silent failures
- Verify you are querying the intended environment/database
- Handle empty chunk sets gracefully in UIs
When it happens
Trigger: Calling list_knowledge_chunks against a knowledge item whose chunk storage returned nil — e.g. knowledge exists but has never been indexed/chunked, or a backend inconsistency where total is unset and chunks is nil.
Common situations: Querying a freshly created FAQ/knowledge entry before ingestion completed; document ingestion pipeline failed silently; querying the wrong environment/database with sparse data.
Related errors
- all document retrievals failed
- missing query parameter
- no search targets available
- no queries provided
- missing id parameter
AI-assisted analysis of Tencent/WeKnora@988cbb0330 (2026-09-02).
Data as JSON: /api/errors/ec273fbb54d631f1.
Report an issue: GitHub.