{"record":{"id":"ce665be425894c13","repo":"Tencent/WeKnora","slug":"move-wiki-page-w","errorCode":null,"errorMessage":"move wiki page: %w","messagePattern":"move wiki page: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/application/service/wiki_page.go","lineNumber":1612,"sourceCode":"}\n\n// MovePage relocates a page into folderID (\"\" = root) and refreshes its cached\n// category path. Bookkeeping-only write (no version bump).\nfunc (s *wikiPageService) MovePage(\n\tctx context.Context, kbID string, slug string, folderID string,\n) (*types.WikiPage, error) {\n\tpage, err := s.repo.GetBySlug(ctx, kbID, slug)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tpage.FolderID = strings.TrimSpace(folderID)\n\tif err := s.applyFolderToPage(ctx, page); err != nil {\n\t\treturn nil, err\n\t}\n\tpage.UpdatedAt = time.Now()\n\tnormalizeWikiHierarchy(page)\n\tif err := s.repo.UpdateMeta(ctx, page); err != nil {\n\t\treturn nil, fmt.Errorf(\"move wiki page: %w\", err)\n\t}\n\treturn page, nil\n}\n\n// RenameOrMoveFolder renames and/or reparents a folder, then recomputes the\n// materialized path/depth of the entire subtree and the cached category path of\n// every page underneath. Guards against cycles (moving a folder into itself or\n// one of its descendants) and sibling name collisions.\nfunc (s *wikiPageService) RenameOrMoveFolder(\n\tctx context.Context, kbID string, id string, newName string, newParentID string, moveParent bool,\n) (*types.WikiFolder, error) {\n\tfolder, err := s.repo.GetFolderByID(ctx, kbID, id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tname := folder.Name\n\tif strings.TrimSpace(newName) != \"\" {","sourceCodeStart":1594,"sourceCodeEnd":1630,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/application/service/wiki_page.go#L1594-L1630","documentation":"MovePage wraps the repo.UpdateMeta failure after the page's FolderID and cached category path were recalculated. The move is bookkeeping-only (no version bump); a failure leaves the page at its old folder.","triggerScenarios":"Thrown at internal/application/service/wiki_page.go:1612 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check repo/DB health and the wrapped cause","Verify the target folder still exists","Retry the move"],"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"}