Tencent/WeKnora · error
parse rss credentials: %w
Error message
parse rss credentials: %w
What it means
After marshaling, parseConfig unmarshals the credential bytes into the RSS Config struct. A failure here means the stored credentials are not valid JSON or do not decode cleanly into Config. This typically indicates a corrupt or wrong-shaped credentials payload persisted for the datasource.
Source
Thrown at internal/datasource/connector/rss/types.go:65
FeedURLs string `json:"feed_urls"`
// AuthHeaders is an optional newline-separated list of custom request
// headers in "Name: Value" form, applied only to feed fetches.
AuthHeaders string `json:"auth_headers,omitempty"`
}
// 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 ""
}View on GitHub (pinned to 988cbb0330)
Solutions
- Inspect the stored credentials JSON for the datasource and re-save it as a valid JSON object with a feed_urls field.
- Re-author/re-configure the datasource through the UI so the service re-serializes credentials correctly.
- Validate the JSON with a parser (jq/JSON lint) before saving; fix syntax errors.
- Check for migrations that changed the credentials schema and migrate old records.
Example fix
// before (stored credentials)
feed_urls: https://a.example/rss, https://b.example/rss // not JSON
// after
{"feed_urls": "https://a.example/rss, https://b.example/rss"} Defensive patterns
Strategy: validation
Validate before calling
raw, _ := json.Marshal(config.Credentials)
var probe map[string]interface{}
if err := json.Unmarshal(raw, &probe); err != nil {
return fmt.Errorf("stored credentials are not valid JSON: %w", err)
} Type guard
func isJSONObject(b []byte) bool {
var v map[string]interface{}
return json.Unmarshal(b, &v) == nil
} Try / catch
cfg, err := parseConfig(config)
if err != nil && strings.Contains(err.Error(), "parse rss credentials") {
// prompt user to re-configure the source
return err
} Prevention
- Validate credentials JSON with a parser before persisting.
- Never hand-edit credentials in the DB; use the configuration UI/API.
- Add schema migrations for credential shape changes.
When it happens
Trigger: The datasource's credentials value is not valid JSON (corrupt row, binary data, partially written update), or the unmarshal cannot populate the Config struct from the JSON value.
Common situations: A migration changed the credentials schema; an operator pasted YAML/TOML into the credentials field instead of JSON; a database write was truncated; an old datasource stored credentials in a now-unsupported shape.
Related errors
- marshal credentials: %w
- E2BAPIKey is required for the E2B backend
- failed to generate KS3 presigned URL: %w
- failed to set FAQ metadata: %w
- invalid URL: %w
AI-assisted analysis of Tencent/WeKnora@988cbb0330 (2026-09-02).
Data as JSON: /api/errors/a3a0dbb30150e617.
Report an issue: GitHub.