glanceapp/glance · error
subreddit is required
Error message
subreddit is required
What it means
Thrown by the reddit widget's initialize() when subreddit is empty. The subreddit name drives both the widget title ('r/<name>') and the request URL used to fetch posts, so it is the one required field; sort-by and top-period get defaults instead of erroring.
Solutions
- Set subreddit: to a single community name without the r/ prefix, e.g. subreddit: selfhosted
- For multiple communities, add one reddit widget per subreddit
- Verify the key is spelled 'subreddit' and top-level within the widget
Example fix
# before - type: reddit sort-by: top # after - type: reddit subreddit: selfhosted sort-by: top
Defensive patterns
Strategy: validation
Validate before calling
if w['type'] == 'reddit' and not w.get('subreddit'):
raise ValueError('reddit widget requires subreddit') Prevention
- One subreddit per widget; no r/ prefix, no lists, no +multi syntax
- Fill in subreddit immediately after type when adding the widget
- Lint required fields for all widget types in a config checker
When it happens
Trigger: A widget of type: reddit with no subreddit key; subreddit misspelled (sub-reddit:, sub:); an empty value from a templated/generated config.
Common situations: Copy-pasting the reddit widget example and forgetting to fill in the subreddit; multi-subreddit users expecting a list (only a single name is supported here).
Related errors
- application name, client ID and client secret are required
- no ` ` placeholder specified
- could not umarshal repository into string or struct
- hour-format must be either 12h or 24h
- invalid duration format
AI-assisted analysis of glanceapp/glance@91324e8de7 (2026-08-15).
Data as JSON: /api/errors/1251fbe0d7375d89.
Report an issue: GitHub.
Appendix: source
Thrown at internal/glance/widget-reddit.go:58
CommentsURLTemplate string `yaml:"comments-url-template"`
Limit int `yaml:"limit"`
CollapseAfter int `yaml:"collapse-after"`
RequestURLTemplate string `yaml:"request-url-template"`
AppAuth struct {
Name string `yaml:"name"`
ID string `yaml:"id"`
Secret string `yaml:"secret"`
enabled bool
accessToken string
tokenExpiresAt time.Time
} `yaml:"app-auth"`
}
func (widget *redditWidget) initialize() error {
if widget.Subreddit == "" {
return errors.New("subreddit is required")
}
if widget.Limit <= 0 {
widget.Limit = 15
}
if widget.CollapseAfter == 0 || widget.CollapseAfter < -1 {
widget.CollapseAfter = 5
}
s := widget.SortBy
if s != "hot" && s != "new" && s != "top" && s != "rising" {
widget.SortBy = "hot"
}
p := widget.TopPeriod
if p != "hour" && p != "day" && p != "week" && p != "month" && p != "year" && p != "all" {
widget.TopPeriod = "day"View on GitHub (pinned to 91324e8de7)