Tencent/WeKnora · error
create wiki folder %q: %w
Error message
create wiki folder %q: %w
What it means
FindOrCreateFolderPath wraps repo.CreateFolder failure only when the post-race re-fetch (GetChildFolderByName) also fails — i.e., a genuine create error, not a lost race. The folder path (and the move/plan depending on it) cannot be established.
Source
Thrown at internal/application/service/wiki_page.go:1586
}
now := time.Now()
child = &types.WikiFolder{
ID: uuid.New().String(),
TenantID: tenantID,
KnowledgeBaseID: kbID,
ParentID: parentID,
Name: name,
Path: fp,
Depth: depth + 1,
CreatedAt: now,
UpdatedAt: now,
}
if cerr := s.repo.CreateFolder(ctx, child); cerr != nil {
// Lost a create race (or unique violation): the sibling must
// now exist — re-fetch it rather than failing the whole plan.
child, err = s.repo.GetChildFolderByName(ctx, kbID, parentID, name)
if err != nil {
return "", nil, fmt.Errorf("create wiki folder %q: %w", fp, cerr)
}
}
}
parentID = child.ID
parentPath = child.Path
}
return parentID, clean, nil
}
// MovePage relocates a page into folderID ("" = root) and refreshes its cached
// category path. Bookkeeping-only write (no version bump).
func (s *wikiPageService) MovePage(
ctx context.Context, kbID string, slug string, folderID string,
) (*types.WikiPage, error) {
page, err := s.repo.GetBySlug(ctx, kbID, slug)
if err != nil {
return nil, err
}View on GitHub (pinned to 988cbb0330)
Solutions
- Inspect the wrapped create error (constraints, DB down)
- Check for name/path conflicts on the sibling folder
- Retry; concurrent creators resolve via the re-fetch path
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at internal/application/service/wiki_page.go:1586 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/0fc361e43d4f391a.
Report an issue: GitHub.