{"record":{"id":"6f218e25d3dd331f","repo":"Tencent/WeKnora","slug":"get-existing-page-w","errorCode":null,"errorMessage":"get existing page: %w","messagePattern":"get existing page: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/application/service/wiki_page.go","lineNumber":214,"sourceCode":"\treturn existing, nil\n}\n\n// UpdatePageMeta updates only metadata (status, source_refs) without version bump or link re-parse.\nfunc (s *wikiPageService) UpdatePageMeta(ctx context.Context, page *types.WikiPage) error {\n\tnormalizeWikiHierarchy(page)\n\tpage.UpdatedAt = time.Now()\n\treturn s.repo.UpdateMeta(ctx, page)\n}\n\n// UpdateAutoLinkedContent persists content produced by machine-only link\n// decorators (cross-link injection / dead-link cleanup) without bumping\n// `version`. Out-links are re-parsed from the new body and bidirectional\n// in-link references on target pages are refreshed so link navigation stays\n// consistent — only the user-facing revision counter is preserved.\nfunc (s *wikiPageService) UpdateAutoLinkedContent(ctx context.Context, page *types.WikiPage) error {\n\texisting, err := s.repo.GetBySlug(ctx, page.KnowledgeBaseID, page.Slug)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"get existing page: %w\", err)\n\t}\n\n\toldOutLinks := existing.OutLinks\n\n\texisting.Content = stripWikiInlineChunkCitations(page.Content)\n\texisting.OutLinks = s.parseOutLinks(existing.Content)\n\texisting.UpdatedAt = time.Now()\n\n\tif err := s.repo.UpdateAutoLinkedContent(ctx, existing); err != nil {\n\t\treturn fmt.Errorf(\"update auto-linked content: %w\", err)\n\t}\n\n\ts.removeInLinks(ctx, existing.KnowledgeBaseID, existing.Slug, oldOutLinks)\n\ts.updateInLinks(ctx, existing.KnowledgeBaseID, existing.Slug, existing.OutLinks)\n\n\treturn nil\n}\n","sourceCodeStart":196,"sourceCodeEnd":232,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/application/service/wiki_page.go#L196-L232","documentation":"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.","triggerScenarios":"Thrown at internal/application/service/wiki_page.go:214 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the wiki page repo and DB availability","Verify the slug exists in the knowledge base","Retry the link-decoration pass"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"988cbb03305e055d8ebb7d46d9ac6cc0803cd074","analyzedAt":"2026-09-02T14:41:08.344Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}