Tencent/WeKnora · error
failed to find tag by seq_id %d: %w
Error message
failed to find tag by seq_id %d: %w
What it means
Resolving a tag from its numeric seq_id failed: tagRepo.GetBySeqID errored or found nothing for the tenant, so the FAQ entry cannot be associated with the requested tag and creation/update is aborted.
Source
Thrown at internal/application/service/knowledge_faq.go:1954
}
// hashQuestion 计算问题内容的哈希值,用于生成稳定的 sourceID。
func hashQuestion(question string) string {
h := md5.Sum([]byte(question))
return hex.EncodeToString(h[:4])
}
// resolveTagID resolves tag ID (UUID) from payload, prioritizing tag_id (seq_id) over tag_name
// If no tag is specified, creates or finds the "未分类" tag
// Returns the internal UUID of the tag
func (s *knowledgeService) resolveTagID(ctx context.Context, kbID string, payload *types.FAQEntryPayload) (string, error) {
tenantID := ctx.Value(types.TenantIDContextKey).(uint64)
// 如果提供了 tag_id (seq_id),优先使用 tag_id
if payload.TagID != 0 {
tag, err := s.tagRepo.GetBySeqID(ctx, tenantID, payload.TagID)
if err != nil {
return "", fmt.Errorf("failed to find tag by seq_id %d: %w", payload.TagID, err)
}
return tag.ID, nil
}
// 如果提供了 tag_name,查找或创建标签
if payload.TagName != "" {
tag, err := s.tagService.FindOrCreateTagByName(ctx, kbID, payload.TagName)
if err != nil {
return "", fmt.Errorf("failed to resolve tag by name '%s': %w", payload.TagName, err)
}
return tag.ID, nil
}
// 都没有提供,使用"未分类"标签
tag, err := s.tagService.FindOrCreateTagByName(ctx, kbID, types.UntaggedTagName)
if err != nil {
return "", fmt.Errorf("failed to get or create default untagged tag: %w", err)
}View on GitHub (pinned to 988cbb0330)
Solutions
- Verify the tag seq_id exists for this tenant
- Check tag repository connectivity
- Fall back to tag_name resolution when seq_id lookup fails
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at internal/application/service/knowledge_faq.go:1954 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of Tencent/WeKnora@988cbb0330 (2026-09-02).
Data as JSON: /api/errors/064371e6cce29fe2.
Report an issue: GitHub.