Tencent/WeKnora · error

update auto-linked content: %w

Error message

update auto-linked content: %w

What it means

UpdateAutoLinkedContent wraps the repo update failure after re-parsing out-links. The machine-only write (no version bump) failed, so in-link references on target pages may be stale relative to the intended content.

Source

Thrown at internal/application/service/wiki_page.go:224

// UpdateAutoLinkedContent persists content produced by machine-only link
// decorators (cross-link injection / dead-link cleanup) without bumping
// `version`. Out-links are re-parsed from the new body and bidirectional
// in-link references on target pages are refreshed so link navigation stays
// consistent — only the user-facing revision counter is preserved.
func (s *wikiPageService) UpdateAutoLinkedContent(ctx context.Context, page *types.WikiPage) error {
	existing, err := s.repo.GetBySlug(ctx, page.KnowledgeBaseID, page.Slug)
	if err != nil {
		return fmt.Errorf("get existing page: %w", err)
	}

	oldOutLinks := existing.OutLinks

	existing.Content = stripWikiInlineChunkCitations(page.Content)
	existing.OutLinks = s.parseOutLinks(existing.Content)
	existing.UpdatedAt = time.Now()

	if err := s.repo.UpdateAutoLinkedContent(ctx, existing); err != nil {
		return fmt.Errorf("update auto-linked content: %w", err)
	}

	s.removeInLinks(ctx, existing.KnowledgeBaseID, existing.Slug, oldOutLinks)
	s.updateInLinks(ctx, existing.KnowledgeBaseID, existing.Slug, existing.OutLinks)

	return nil
}

// revisionFromPage builds the immutable snapshot row for the given page
// state. EditSource on the snapshot is the author of THAT version — the
// page's provenance columns as they stood while the version was current —
// not whoever is performing the write that supersedes it.
func revisionFromPage(p *types.WikiPage) *types.WikiPageRevision {
	return &types.WikiPageRevision{
		ID:              uuid.New().String(),
		TenantID:        p.TenantID,
		KnowledgeBaseID: p.KnowledgeBaseID,
		PageID:          p.ID,

View on GitHub (pinned to 988cbb0330)

Solutions

  1. Check DB/repo health and the wrapped cause
  2. Retry InjectCrossLinks; the update is idempotent for identical content
  3. Verify the page wasn't concurrently deleted
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at internal/application/service/wiki_page.go:224 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/86ad757f41caf254. Report an issue: GitHub.