{"record":{"id":"6887049d1c9643f7","repo":"glanceapp/glance","slug":"key-q-does-not-exist-in-options","errorCode":null,"errorMessage":"key %q does not exist in options","messagePattern":"key %q does not exist in options","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/glance/widget-custom-api.go","lineNumber":114,"sourceCode":"\treturn customAPIGetOptionOrDefault(*o, key, defaultValue)\n}\n\nfunc (o *customAPIOptions) IntOr(key string, defaultValue int) int {\n\treturn customAPIGetOptionOrDefault(*o, key, defaultValue)\n}\n\nfunc (o *customAPIOptions) FloatOr(key string, defaultValue float64) float64 {\n\treturn customAPIGetOptionOrDefault(*o, key, defaultValue)\n}\n\nfunc (o *customAPIOptions) BoolOr(key string, defaultValue bool) bool {\n\treturn customAPIGetOptionOrDefault(*o, key, defaultValue)\n}\n\nfunc (o *customAPIOptions) JSON(key string) string {\n\tvalue, exists := (*o)[key]\n\tif !exists {\n\t\tpanic(fmt.Sprintf(\"key %q does not exist in options\", key))\n\t}\n\n\tencoded, err := json.Marshal(value)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"marshaling %s: %v\", key, err))\n\t}\n\n\treturn string(encoded)\n}\n\nfunc customAPIGetOptionOrDefault[T any](o customAPIOptions, key string, defaultValue T) T {\n\tif value, exists := o[key]; exists {\n\t\tif typedValue, ok := value.(T); ok {\n\t\t\treturn typedValue\n\t\t}\n\t}\n\treturn defaultValue\n}","sourceCodeStart":96,"sourceCodeEnd":132,"githubUrl":"https://github.com/glanceapp/glance/blob/91324e8de762702e97b0ac5c8e36271d644d8642/internal/glance/widget-custom-api.go#L96-L132","documentation":"Error \"key %q does not exist in options\" thrown in glanceapp/glance.","triggerScenarios":"Raised when a custom-api widget template references an options key that was not populated by the request or subrequest responses.","commonSituations":"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.","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."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"91324e8de762702e97b0ac5c8e36271d644d8642","analyzedAt":"2026-08-15T14:12:54.279Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}