{"record":{"id":"7bbbaaaa731d823b","repo":"Tencent/WeKnora","slug":"search-notion-pages-w","errorCode":null,"errorMessage":"search notion pages: %w","messagePattern":"search notion pages: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/datasource/connector/notion/connector.go","lineNumber":83,"sourceCode":"\t// Notion returns the full hierarchy (with parent_id populated) in a single\n\t// call, so children are already delivered with the root listing. Lazy-load\n\t// requests for a specific parent therefore have nothing extra to return.\n\tif parentID != \"\" {\n\t\treturn []types.Resource{}, nil\n\t}\n\n\tnotionCfg, err := parseNotionConfig(config)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclient, err := newClient(notionCfg.APIKey, extractBaseURL(config))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tpages, err := client.SearchPages(ctx)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"search notion pages: %w\", err)\n\t}\n\n\tallIDs := make(map[string]bool, len(pages))\n\tfor _, p := range pages {\n\t\tallIDs[p.ID] = true\n\t}\n\n\t// Precompute effective parent for each page.\n\t// data_source objects need database_parent (their `parent` points at the\n\t// database container, not the workspace location); see resolveParentID.\n\tparentOf := make(map[string]string, len(pages))\n\tfor _, p := range pages {\n\t\tif p.InTrash {\n\t\t\tcontinue\n\t\t}\n\t\tparentOf[p.ID] = resolveParentID(p, allIDs)\n\t}\n","sourceCodeStart":65,"sourceCodeEnd":101,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/datasource/connector/notion/connector.go#L65-L101","documentation":"ListResources wraps any failure from client.SearchPages (the whole paginated Notion search used to discover pages the integration can access) with \"search notion pages: %w\". It signals that resource discovery itself failed, before any per-resource fetching starts.","triggerScenarios":"SearchPages fails while ListResources is enumerating accessible pages — invalid API key, pagination error, unmarshal error, or network failure.","commonSituations":"Integration token not configured or revoked, no pages shared with the integration plus an API quirk, network outage during discovery, Notion rate limiting.","solutions":["Check the wrapped cause for auth vs network vs parse failure","Validate the api_key credential (see ErrInvalidCredentials errors)","Share the target pages/databases with the Notion integration in Notion UI","Retry after backing off if the cause is 429/5xx"],"exampleFix":"pages, err := client.SearchPages(ctx)\nif err != nil {\n    log.Printf(\"notion discovery failed: %v\", err) // see wrapped cause\n    return nil, err\n}","handlingStrategy":"try-catch","validationCode":"if err := connector.Validate(ctx, config); err != nil { return err } // fail before discovery","typeGuard":null,"tryCatchPattern":"resources, err := connector.ListResources(ctx, config)\nif err != nil {\n    if errors.Is(err, datasource.ErrInvalidCredentials) { return reconfigurePrompt }\n    return fmt.Errorf(\"notion discovery failed: %w\", err)\n}","preventionTips":["Validate credentials with Validate before discovery runs","Share target pages/databases with the integration in the Notion UI","Wrap discovery with retry/backoff for transient 429/5xx"],"tags":["notion","search","resource-discovery"],"backgroundTag":"api-pagination-failed","analyzedSha":"988cbb03305e055d8ebb7d46d9ac6cc0803cd074","analyzedAt":"2026-09-02T14:41:08.344Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}