Tencent/WeKnora · error

list %s pages: %w

Error message

list %s pages: %w

What it means

GetIndexView lists wiki pages per content type via repo.ListByTypeLight. If the underlying repository call fails (DB down, query error, context canceled), the service wraps it with 'list <type> pages: %w' so the failing content type is identified. It is a wrapped persistence-layer error, not a validation error.

Source

Thrown at internal/application/service/wiki_page.go:507

		}
		offset = v
	}

	// Default to every known content type when the caller passes no
	// filter. Any unknown request-time type is passed through verbatim so
	// future page types (declared in types/wiki_page.go) start showing
	// up in the index the moment the LLM starts creating them, without a
	// handler change.
	selected := pageTypes
	if len(selected) == 0 {
		selected = append([]string{}, wikiIndexContentPageTypes...)
	}

	groups := make([]types.WikiIndexGroup, 0, len(selected))
	for _, pt := range selected {
		entries, total, listErr := s.repo.ListByTypeLight(ctx, kbID, pt, limit, offset)
		if listErr != nil {
			return nil, fmt.Errorf("list %s pages: %w", pt, listErr)
		}
		if entries == nil {
			entries = []types.WikiIndexEntry{}
		}
		for i := range entries {
			normalizeWikiIndexEntryHierarchy(&entries[i], pt)
		}
		next := ""
		// Only emit a cursor when a full page was returned AND more rows
		// remain past `offset + limit`. A short page or one that exactly
		// consumed the remainder should signal end-of-feed.
		if len(entries) == limit && int64(offset+len(entries)) < total {
			next = strconv.Itoa(offset + limit)
		}
		groups = append(groups, types.WikiIndexGroup{
			Type:       pt,
			Total:      total,
			Items:      entries,

View on GitHub (pinned to 988cbb0330)

Solutions

  1. Check database connectivity and service logs for the underlying wrapped error (%w chain).
  2. Retry the request — transient DB/network failures often resolve; consider context timeout adjustments.
  3. Verify the schema/migrations for the pages table and the queried content type are current.
  4. Inspect repo.ListByTypeLight for query or index problems if the error is reproducible for one type.
Defensive patterns

Strategy: retry

Try / catch

groups, err := svc.GetIndexView(ctx, kbID, cursor)
if err != nil {
    var retriable = ctx.Err() == nil // DB blips: retry with backoff
    if retriable && isTransient(err) {
        groups, err = svc.GetIndexView(ctx, kbID, cursor)
    }
    if err != nil { log.Errorf("index view failed: %v", err); return err }
}

Prevention

When it happens

Trigger: Any GetIndexView call where the repository's ListByTypeLight returns an error — database connectivity loss, SQL/schema errors, context deadline/cancellation, or permission failures at the storage layer.

Common situations: Database migrations leaving the wiki_pages table out of sync; transient connection pool exhaustion; request canceled by the client mid-scan of many content types; misconfigured DSN in the service environment.

Understand the failure class

Background: Database query failed: Internal Server Error 500s wrapping SQL, Prisma, and connection failures — what to check first — this error's family across 16 libraries.

Related errors


AI-assisted analysis of Tencent/WeKnora@988cbb0330 (2026-09-02). Data as JSON: /api/errors/cde13b336cd1a706. Report an issue: GitHub.