glanceapp/glance · error
marshaling %s: %v
Error message
marshaling %s: %v
What it means
Error "marshaling %s: %v" thrown in glanceapp/glance.
Source
Thrown at internal/glance/widget-custom-api.go:119
}
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
}
func (req *CustomAPIRequest) initialize() error {
if req == nil || req.URL == "" {
return nil
}View on GitHub (pinned to 91324e8de7)
Solutions
- Ensure the option value being marshaled is JSON-serializable (no channels, functions, or cyclic structures).
- Pass plain values (strings, numbers, booleans, maps, slices) in the custom-api request options.
When it happens
Trigger: Occurs when a value stored in the custom-api options map cannot be marshaled to JSON, e.g. a channel, function, or cyclic structure.
Common situations: Passing a non-JSON-serializable decoded response value into the options map used by the template.
AI-assisted analysis of glanceapp/glance@91324e8de7 (2026-08-15).
Data as JSON: /api/errors/7a57e45c2da826de.
Report an issue: GitHub.