{"record":{"id":"61d96c36a60cdba3","repo":"Tencent/WeKnora","slug":"no-resource-ids-configured","errorCode":null,"errorMessage":"no resource IDs configured","messagePattern":"no resource IDs configured","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/datasource/connector/notion/connector.go","lineNumber":176,"sourceCode":"\t\t\tlogger.Warnf(ctx, \"[Notion] failed to fetch resource %s as page or database\", resourceID)\n\t\t}\n\t\tallItems = append(allItems, items...)\n\t}\n\n\treturn allItems, nil\n}\n\n// FetchIncremental performs an incremental sync based on cursor state.\n// On first sync (nil cursor), delegates to FetchAll for efficiency (no discovery needed).\nfunc (c *Connector) FetchIncremental(ctx context.Context, config *types.DataSourceConfig, cursor *types.SyncCursor) ([]types.FetchedItem, *types.SyncCursor, error) {\n\tnotionCfg, err := parseNotionConfig(config)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tresourceIDs := config.ResourceIDs\n\tif len(resourceIDs) == 0 {\n\t\treturn nil, nil, fmt.Errorf(\"no resource IDs configured\")\n\t}\n\n\tclient, err := newClient(notionCfg.APIKey, extractBaseURL(config))\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\t// Parse previous cursor\n\tvar prevCursor notionCursor\n\tif cursor != nil && cursor.ConnectorCursor != nil {\n\t\tcursorBytes, _ := json.Marshal(cursor.ConnectorCursor)\n\t\t_ = json.Unmarshal(cursorBytes, &prevCursor)\n\t}\n\n\t// First sync: use FetchAll then build cursor from Search API (one call, no block traversal)\n\tisFirstSync := len(prevCursor.PageEditTimes) == 0\n\tif isFirstSync {\n\t\tlogger.Infof(ctx, \"[Notion] first sync, using FetchAll for %d resources\", len(resourceIDs))","sourceCodeStart":158,"sourceCodeEnd":194,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/datasource/connector/notion/connector.go#L158-L194","documentation":"FetchIncremental requires an explicit list of Notion page/database IDs (config.ResourceIDs) to sync incrementally; it cannot discover them itself. When the configuration has no resource IDs it aborts immediately with this plain error.","triggerScenarios":"Calling FetchIncremental with a datasource config whose ResourceIDs slice is empty/absent.","commonSituations":"Operator set up incremental sync without first running ListResources or manually entering page IDs; config migration lost resource_ids; UI failed to persist selections.","solutions":["Populate config.ResourceIDs with the Notion page/database IDs to sync","Run ListResources first to discover IDs, then configure them for incremental fetch","Share the desired pages with the integration so they appear in ListResources"],"exampleFix":"// before\nFetchIncremental(ctx, datasource.Config{Credentials: creds})\n// after\nFetchIncremental(ctx, datasource.Config{\n    Credentials: creds,\n    ResourceIDs: []string{\"page-uuid-1\", \"database-uuid-2\"},\n})","handlingStrategy":"validation","validationCode":"if len(config.ResourceIDs) == 0 { return errors.New(\"incremental fetch requires ResourceIDs; run ListResources first\") }","typeGuard":"func hasResourceIDs(cfg datasource.Config) bool { return len(cfg.ResourceIDs) > 0 }","tryCatchPattern":"if _, _, err := connector.FetchIncremental(ctx, cfg); err != nil && strings.Contains(err.Error(), \"no resource IDs configured\") {\n    // fall back to full FetchAll to discover resources\n    return connector.FetchAll(ctx, cfg)\n}","preventionTips":["Always run ListResources before enabling incremental sync","Persist selected resource IDs in your datasource configuration","Add a config schema check requiring resource_ids for incremental mode"],"tags":["notion","configuration","incremental-sync"],"backgroundTag":"missing-required-config","analyzedSha":"988cbb03305e055d8ebb7d46d9ac6cc0803cd074","analyzedAt":"2026-09-02T14:41:08.344Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}