{"record":{"id":"cde13b336cd1a706","repo":"Tencent/WeKnora","slug":"list-s-pages-w","errorCode":null,"errorMessage":"list %s pages: %w","messagePattern":"list (.+?) pages: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/application/service/wiki_page.go","lineNumber":507,"sourceCode":"\t\t}\n\t\toffset = v\n\t}\n\n\t// Default to every known content type when the caller passes no\n\t// filter. Any unknown request-time type is passed through verbatim so\n\t// future page types (declared in types/wiki_page.go) start showing\n\t// up in the index the moment the LLM starts creating them, without a\n\t// handler change.\n\tselected := pageTypes\n\tif len(selected) == 0 {\n\t\tselected = append([]string{}, wikiIndexContentPageTypes...)\n\t}\n\n\tgroups := make([]types.WikiIndexGroup, 0, len(selected))\n\tfor _, pt := range selected {\n\t\tentries, total, listErr := s.repo.ListByTypeLight(ctx, kbID, pt, limit, offset)\n\t\tif listErr != nil {\n\t\t\treturn nil, fmt.Errorf(\"list %s pages: %w\", pt, listErr)\n\t\t}\n\t\tif entries == nil {\n\t\t\tentries = []types.WikiIndexEntry{}\n\t\t}\n\t\tfor i := range entries {\n\t\t\tnormalizeWikiIndexEntryHierarchy(&entries[i], pt)\n\t\t}\n\t\tnext := \"\"\n\t\t// Only emit a cursor when a full page was returned AND more rows\n\t\t// remain past `offset + limit`. A short page or one that exactly\n\t\t// consumed the remainder should signal end-of-feed.\n\t\tif len(entries) == limit && int64(offset+len(entries)) < total {\n\t\t\tnext = strconv.Itoa(offset + limit)\n\t\t}\n\t\tgroups = append(groups, types.WikiIndexGroup{\n\t\t\tType:       pt,\n\t\t\tTotal:      total,\n\t\t\tItems:      entries,","sourceCodeStart":489,"sourceCodeEnd":525,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/application/service/wiki_page.go#L489-L525","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Check database connectivity and service logs for the underlying wrapped error (%w chain).","Retry the request — transient DB/network failures often resolve; consider context timeout adjustments.","Verify the schema/migrations for the pages table and the queried content type are current.","Inspect repo.ListByTypeLight for query or index problems if the error is reproducible for one type."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"groups, err := svc.GetIndexView(ctx, kbID, cursor)\nif err != nil {\n    var retriable = ctx.Err() == nil // DB blips: retry with backoff\n    if retriable && isTransient(err) {\n        groups, err = svc.GetIndexView(ctx, kbID, cursor)\n    }\n    if err != nil { log.Errorf(\"index view failed: %v\", err); return err }\n}","preventionTips":["Monitor DB health and pool saturation for the service","Keep migrations for wiki pages current","Set generous but bounded context timeouts for index scans","Log the full wrapped error chain to identify the failing content type"],"tags":["database","persistence","wrapped-error"],"backgroundTag":"database-query-failed","analyzedSha":"988cbb03305e055d8ebb7d46d9ac6cc0803cd074","analyzedAt":"2026-09-02T14:41:08.344Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}