Tencent/WeKnora · error

missing id parameter

Error message

missing id parameter

What it means

ListKnowledgeChunks.Execute needs a knowledge identifier to look up chunks. After trimming, if KnowledgeID (any of faq_id/chunk_id/knowledge_id forms) is empty it returns this error. It is a fail-fast validation that no ID was supplied at all — distinct from authorization or not-found errors.

Source

Thrown at internal/agent/tools/list_knowledge_chunks.go:117

			Success: false,
			Error:   fmt.Sprintf("Failed to parse args: %v", err),
		}, err
	}

	chunkID := strings.TrimSpace(input.FAQID)
	if chunkID == "" {
		chunkID = strings.TrimSpace(input.ChunkID)
	}
	if chunkID != "" {
		return t.executeByChunkID(ctx, chunkID)
	}

	knowledgeID := strings.TrimSpace(input.KnowledgeID)
	if knowledgeID == "" {
		return &types.ToolResult{
			Success: false,
			Error:   "one of faq_id, chunk_id, or knowledge_id is required",
		}, fmt.Errorf("missing id parameter")
	}

	knowledge, err := authorizeKnowledgeInSearchTargets(ctx, t.searchTargets, knowledgeID, t.knowledgeService)
	if err != nil {
		return &types.ToolResult{
			Success: false,
			Error:   fmt.Sprintf("Knowledge is not accessible: %v", err),
		}, err
	}

	// Use the knowledge's actual tenant_id for chunk query (supports cross-tenant shared KB)
	effectiveTenantID := knowledge.TenantID

	chunkLimit := 20
	if input.Limit > 0 {
		chunkLimit = input.Limit
	}
	offset := 0

View on GitHub (pinned to 988cbb0330)

Solutions

  1. Supply a non-empty knowledge_id (or faq_id/chunk_id) in the tool input
  2. Trim and validate the ID in the caller before invoking
  3. Fetch a valid knowledge ID from a search/list tool if none is known

Example fix

// before
Execute(ctx, map[string]any{"knowledge_id": "   "})
// after
id := strings.TrimSpace(kbID)
if id == "" { return errors.New("knowledge_id required") }
Execute(ctx, map[string]any{"knowledge_id": id})
Defensive patterns

Strategy: validation

Validate before calling

id := strings.TrimSpace(input["knowledge_id"])
if id == "" { return errors.New("one of faq_id, chunk_id, or knowledge_id is required") }

Type guard

func hasKnowledgeID(input map[string]any) bool {
    id, ok := input["knowledge_id"].(string)
    return ok && strings.TrimSpace(id) != ""
}

Try / catch

res, err := tool.Execute(ctx, input)
if err != nil && strings.Contains(err.Error(), "missing id parameter") {
    return res, nil // ToolResult.Error already explains required fields
}

Prevention

When it happens

Trigger: Calling list_knowledge_chunks with knowledge_id absent, empty string, or only whitespace.

Common situations: Agent omits the id field in the tool call; caller passes a variable that was never set; key-name mismatch in the params map leaves the field blank.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of Tencent/WeKnora@988cbb0330 (2026-09-02). Data as JSON: /api/errors/a9a480e55ec0ce1c. Report an issue: GitHub.