{"record":{"id":"ef7106df8c8d1ae7","repo":"Tencent/WeKnora","slug":"wiki-folder-not-found","errorCode":null,"errorMessage":"wiki folder not found","messagePattern":"wiki folder not found","errorType":"error_code","errorClass":null,"httpStatus":404,"severity":"error","filePath":"internal/application/repository/wiki_page.go","lineNumber":606,"sourceCode":"\t\tWhere(\"knowledge_base_id = ? AND path <> ?\", kbID, \"\").\n\t\tOrder(\"path ASC\").\n\t\tLimit(maxPaths).\n\t\tPluck(\"path\", &paths).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tout := make([][]string, 0, len(paths))\n\tfor _, p := range paths {\n\t\tif seg := types.CleanWikiCategoryPath(strings.Split(p, \"/\")); len(seg) > 0 {\n\t\t\tout = append(out, seg)\n\t\t}\n\t}\n\treturn out, nil\n}\n\n// --- Folder tree (wiki_folders) ---\n\n// ErrWikiFolderNotFound is returned when a wiki folder is not found.\nvar ErrWikiFolderNotFound = errors.New(\"wiki folder not found\")\n\n// ErrWikiFolderConflict is returned when a sibling folder with the same name\n// already exists under the same parent.\nvar ErrWikiFolderConflict = errors.New(\"wiki folder name conflict\")\n\n// ErrWikiFolderNotEmpty is returned when a folder still has a live page or\n// child folder at the instant an atomic delete is attempted.\nvar ErrWikiFolderNotEmpty = errors.New(\"wiki folder is not empty\")\n\nfunc (r *wikiPageRepository) CreateFolder(ctx context.Context, folder *types.WikiFolder) error {\n\treturn r.db.WithContext(ctx).Create(folder).Error\n}\n\nfunc (r *wikiPageRepository) GetFolderByID(ctx context.Context, kbID string, id string) (*types.WikiFolder, error) {\n\tvar folder types.WikiFolder\n\tif err := r.db.WithContext(ctx).\n\t\tWhere(\"knowledge_base_id = ? AND id = ?\", kbID, id).\n\t\tFirst(&folder).Error; err != nil {","sourceCodeStart":588,"sourceCodeEnd":624,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/application/repository/wiki_page.go#L588-L624","documentation":"Sentinel ErrWikiFolderNotFound returned by folder lookups (GetFolderByPath/GetFolderByID) when gorm.ErrRecordNotFound is raised — no folder row in wiki_folders matches within the knowledge base. Distinguishes a missing folder from other DB errors.","triggerScenarios":"Thrown at internal/application/repository/wiki_page.go:606 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the folder id/path and knowledge-base id; the folder may have been deleted or moved","Create the folder on demand or return 404 to the caller"],"exampleFix":null,"handlingStrategy":"type-guard","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"}