Tencent/WeKnora · error

ErrInvalidCredentials

ErrInvalidCredentials

Error message

%w: feed_urls is required

What it means

parseConfig validates that at least one RSS feed URL is configured. After merging feed URLs from Settings and Credentials, if feedURLList() is empty it wraps datasource.ErrInvalidCredentials with "feed_urls is required". The connector cannot operate without at least one feed to fetch.

Source

Thrown at internal/datasource/connector/rss/types.go:71

// parseConfig extracts and validates RSS configuration.
func parseConfig(config *types.DataSourceConfig) (*Config, error) {
	if config == nil {
		return nil, fmt.Errorf("%w: config is nil", datasource.ErrInvalidConfig)
	}
	credBytes, err := json.Marshal(config.Credentials)
	if err != nil {
		return nil, fmt.Errorf("marshal credentials: %w", err)
	}
	var cfg Config
	if err := json.Unmarshal(credBytes, &cfg); err != nil {
		return nil, fmt.Errorf("parse rss credentials: %w", err)
	}
	if urls := feedURLsFromSettings(config.Settings); urls != "" {
		cfg.FeedURLs = urls
	}
	if len(cfg.feedURLList()) == 0 {
		return nil, fmt.Errorf("%w: feed_urls is required", datasource.ErrInvalidCredentials)
	}
	return &cfg, nil
}

func feedURLsFromSettings(settings map[string]interface{}) string {
	if len(settings) == 0 {
		return ""
	}
	raw, ok := settings["feed_urls"]
	if !ok {
		return ""
	}
	s, ok := raw.(string)
	if !ok {
		return ""
	}
	return strings.TrimSpace(s)
}

View on GitHub (pinned to 988cbb0330)

Solutions

  1. Set feed_urls in the datasource settings (or credentials) to a non-empty comma-separated list of RSS feed URLs.
  2. Verify the UI/client sends the key exactly as feed_urls in Settings.
  3. Re-save the datasource through the configuration UI to regenerate the credentials payload.
  4. If migrating legacy sources, copy feed URLs from credentials into Settings.

Example fix

// before
settings := map[string]interface{}{}
// after
settings := map[string]interface{}{
    "feed_urls": "https://example.com/feed.xml, https://other.example/rss",
}
Defensive patterns

Strategy: validation

Validate before calling

urls := settings["feed_urls"]
u, _ := urls.(string)
if strings.TrimSpace(u) == "" {
    return errors.New("feed_urls is required: provide a comma-separated list of RSS feed URLs")
}

Type guard

func hasFeedURLs(settings map[string]interface{}) bool {
    s, ok := settings["feed_urls"].(string)
    return ok && strings.TrimSpace(s) != ""
}

Try / catch

cfg, err := parseConfig(config)
if errors.Is(err, datasource.ErrInvalidCredentials) {
    // return a 4xx-style "missing feed_urls" message to the user
    return err
}

Prevention

When it happens

Trigger: Creating/updating an RSS datasource where neither config.Settings['feed_urls'] nor credentials contain feed URLs; Validate, ListResources, or a walk invoked on such a source.

Common situations: A user saved the RSS source without filling in the feed URL field; the feed URL was placed under a wrong settings key after a UI rename; a legacy source kept URLs only in credentials while settings handling moved; copy-paste omitted the comma-separated list.

Understand the failure class

Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.

Related errors


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