Tencent/WeKnora · error

empty result

Error message

empty result

What it means

Sentinel inner error produced when GetPageBySlug returns no error but a nil page while rewriting incoming wiki links: the storage 'succeeded' with nothing, so this guard substitutes a non-nil error so the caller's load-failure wrapping has a cause to chain; the loop stops and already-applied changes are returned for compensation.

Source

Thrown at internal/agent/tools/wiki_link_mutation.go:35

}

// applyIncomingWikiContentRewrite updates machine-maintained links without
// incrementing user-visible page versions. It stops on the first failure and
// returns the already-applied changes so the caller can compensate.
func applyIncomingWikiContentRewrite(
	ctx context.Context,
	service interfaces.WikiPageService,
	kbID string,
	inLinks []string,
	rewrite wikiContentRewrite,
) ([]appliedWikiContentChange, []string, error) {
	var changes []appliedWikiContentChange
	var updatedSlugs []string
	for _, sourceSlug := range dedupNonEmptyStrings(inLinks) {
		page, err := service.GetPageBySlug(ctx, kbID, sourceSlug)
		if err != nil || page == nil {
			if err == nil {
				err = fmt.Errorf("empty result")
			}
			return changes, updatedSlugs, fmt.Errorf("load incoming page %s: %w", sourceSlug, err)
		}
		updatedContent, changed := rewrite(page.Content)
		if !changed {
			continue
		}
		original := page.Content
		page.Content = updatedContent
		if err := service.UpdateAutoLinkedContent(ctx, page); err != nil {
			page.Content = original
			return changes, updatedSlugs, fmt.Errorf("update incoming page %s: %w", sourceSlug, err)
		}
		changes = append(changes, appliedWikiContentChange{page: page, originalContent: original})
		updatedSlugs = append(updatedSlugs, sourceSlug)
	}
	return changes, updatedSlugs, nil
}

View on GitHub (pinned to 988cbb0330)

Solutions

  1. Verify the incoming-link slug actually exists as a page
  2. Check for stale incoming-link metadata referencing deleted pages
  3. Make the storage layer return a typed not-found error instead of nil,nil
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at internal/agent/tools/wiki_link_mutation.go:35 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/120bda6a50646f0f. Report an issue: GitHub.