Tencent/WeKnora · error

get existing page: %w

Error message

get existing page: %w

What it means

UpdateAutoLinkedContent wraps repo.GetBySlug failure when fetching the current page before overwriting machine-decorated content (cross-link injection / dead-link cleanup). Without the existing row the link-consistent update cannot proceed.

Source

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

	return existing, nil
}

// UpdatePageMeta updates only metadata (status, source_refs) without version bump or link re-parse.
func (s *wikiPageService) UpdatePageMeta(ctx context.Context, page *types.WikiPage) error {
	normalizeWikiHierarchy(page)
	page.UpdatedAt = time.Now()
	return s.repo.UpdateMeta(ctx, page)
}

// 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
}

View on GitHub (pinned to 988cbb0330)

Solutions

  1. Check the wiki page repo and DB availability
  2. Verify the slug exists in the knowledge base
  3. Retry the link-decoration pass
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at internal/application/service/wiki_page.go:214 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/6f218e25d3dd331f. Report an issue: GitHub.