Tencent/WeKnora · error
wiki folder not found
Error message
wiki folder not found
What it means
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.
Source
Thrown at internal/application/repository/wiki_page.go:606
Where("knowledge_base_id = ? AND path <> ?", kbID, "").
Order("path ASC").
Limit(maxPaths).
Pluck("path", &paths).Error; err != nil {
return nil, err
}
out := make([][]string, 0, len(paths))
for _, p := range paths {
if seg := types.CleanWikiCategoryPath(strings.Split(p, "/")); len(seg) > 0 {
out = append(out, seg)
}
}
return out, nil
}
// --- Folder tree (wiki_folders) ---
// ErrWikiFolderNotFound is returned when a wiki folder is not found.
var ErrWikiFolderNotFound = errors.New("wiki folder not found")
// ErrWikiFolderConflict is returned when a sibling folder with the same name
// already exists under the same parent.
var ErrWikiFolderConflict = errors.New("wiki folder name conflict")
// ErrWikiFolderNotEmpty is returned when a folder still has a live page or
// child folder at the instant an atomic delete is attempted.
var ErrWikiFolderNotEmpty = errors.New("wiki folder is not empty")
func (r *wikiPageRepository) CreateFolder(ctx context.Context, folder *types.WikiFolder) error {
return r.db.WithContext(ctx).Create(folder).Error
}
func (r *wikiPageRepository) GetFolderByID(ctx context.Context, kbID string, id string) (*types.WikiFolder, error) {
var folder types.WikiFolder
if err := r.db.WithContext(ctx).
Where("knowledge_base_id = ? AND id = ?", kbID, id).
First(&folder).Error; err != nil {View on GitHub (pinned to 988cbb0330)
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
Defensive patterns
Strategy: type-guard
When it happens
Trigger: Thrown at internal/application/repository/wiki_page.go:606 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/ef7106df8c8d1ae7.
Report an issue: GitHub.