glanceapp/glance · error
key %q does not exist in options
Error message
key %q does not exist in options
What it means
Error "key %q does not exist in options" thrown in glanceapp/glance.
Source
Thrown at internal/glance/widget-custom-api.go:114
return customAPIGetOptionOrDefault(*o, key, defaultValue)
}
func (o *customAPIOptions) IntOr(key string, defaultValue int) int {
return customAPIGetOptionOrDefault(*o, key, defaultValue)
}
func (o *customAPIOptions) FloatOr(key string, defaultValue float64) float64 {
return customAPIGetOptionOrDefault(*o, key, defaultValue)
}
func (o *customAPIOptions) BoolOr(key string, defaultValue bool) bool {
return customAPIGetOptionOrDefault(*o, key, defaultValue)
}
func (o *customAPIOptions) JSON(key string) string {
value, exists := (*o)[key]
if !exists {
panic(fmt.Sprintf("key %q does not exist in options", key))
}
encoded, err := json.Marshal(value)
if err != nil {
panic(fmt.Sprintf("marshaling %s: %v", key, err))
}
return string(encoded)
}
func customAPIGetOptionOrDefault[T any](o customAPIOptions, key string, defaultValue T) T {
if value, exists := o[key]; exists {
if typedValue, ok := value.(T); ok {
return typedValue
}
}
return defaultValue
}View on GitHub (pinned to 91324e8de7)
Solutions
- In the custom-api widget template, only call .JSON on keys that are guaranteed to exist in the response 'options' you defined.
- Add the missing key to the request's options in the widget configuration, or use a default-safe accessor pattern instead of .JSON.
- Check for typos in the key name passed to .JSON in the template.
When it happens
Trigger: Raised when a custom-api widget template references an options key that was not populated by the request or subrequest responses.
Common situations: A typo in the template placeholder name, a subrequest that failed so its key was never set, or referencing a key before the subrequest that defines it ran.
AI-assisted analysis of glanceapp/glance@91324e8de7 (2026-08-15).
Data as JSON: /api/errors/6887049d1c9643f7.
Report an issue: GitHub.