Tencent/WeKnora · error
ego graph requires a center slug
Error message
ego graph requires a center slug
What it means
Raised in computeGraphSubset when WikiGraphModeEgo is requested but req.Center is an empty slug — the ego graph slice is defined by a center node, so without one the request is invalid. Input guard before center-page existence is checked.
Source
Thrown at internal/application/service/wiki_page.go:628
for _, id := range req.FamiliarKnowledgeIDs {
if id = strings.TrimSpace(id); id != "" {
familiarSet[id] = struct{}{}
}
}
pageBySlug := make(map[string]*types.WikiPage, len(pages))
linkCount := make(map[string]int, len(pages))
for _, p := range pages {
pageBySlug[p.Slug] = p
linkCount[p.Slug] = len(p.InLinks) + len(p.OutLinks)
}
// Select the node slug set for the requested slice.
var selected map[string]struct{}
switch mode {
case types.WikiGraphModeEgo:
if req.Center == "" {
return nil, errors.New("ego graph requires a center slug")
}
if _, ok := pageBySlug[req.Center]; !ok {
return nil, fmt.Errorf("ego center slug %q not found", req.Center)
}
depth := req.Depth
if depth < 1 {
depth = 1
}
selected = bfsEgoSlugs(pageBySlug, req.Center, depth, typeAllow, req.Limit)
default:
// overview: keep only type-allowed candidates, sort by link_count desc, cap.
candidates := make([]*types.WikiPage, 0, len(pages))
for _, p := range pages {
if hasTypeFilter && !typeAllow[p.PageType] {
continue
}
candidates = append(candidates, p)
}View on GitHub (pinned to 988cbb0330)
Solutions
- Provide a center slug in the graph request when using ego mode
- Use overview mode if no specific center node is intended
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at internal/application/service/wiki_page.go:628 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/c94f88b96b94a54e.
Report an issue: GitHub.