glanceapp/glance · error
subrequest with key %q has not been defined
Error message
subrequest with key %q has not been defined
What it means
Error "subrequest with key %q has not been defined" thrown in glanceapp/glance.
Source
Thrown at internal/glance/widget-custom-api.go:225
result := make([]decoratedGJSONResult, 0, 5)
gjson.ForEachLine(data.JSON.Raw, func(line gjson.Result) bool {
result = append(result, decoratedGJSONResult{line})
return true
})
return result
}
func (data *customAPITemplateData) Subrequest(key string) *customAPIResponseData {
req, exists := data.subrequests[key]
if !exists {
// We have to panic here since there's nothing sensible we can return and the
// lack of an error would cause requested data to return zero values which
// would be confusing from the user's perspective. Go's template module
// handles recovering from panics and will return the panic message as an
// error during template execution.
panic(fmt.Sprintf("subrequest with key %q has not been defined", key))
}
return req
}
func fetchCustomAPIResponse(ctx context.Context, req *CustomAPIRequest) (*customAPIResponseData, error) {
if req == nil || req.URL == "" {
return &customAPIResponseData{
JSON: decoratedGJSONResult{gjson.Result{}},
Response: &http.Response{},
}, nil
}
if req.bodyReader != nil {
req.bodyReader.Seek(0, io.SeekStart)
}
client := ternary(req.AllowInsecure, defaultInsecureHTTPClient, defaultHTTPClient)View on GitHub (pinned to 91324e8de7)
Solutions
- Define the subrequest with the same key under the widget's 'subrequests' section before referencing it with .Subrequest in the template.
- Check for typos in the subrequest key used in the template versus the key defined in the configuration.
When it happens
Trigger: Raised when the template references a subrequest key that was never declared in the widget's subrequests configuration.
Common situations: Renaming or removing a subrequest without updating the template, or a typo in the subrequest key used in the template.
AI-assisted analysis of glanceapp/glance@91324e8de7 (2026-08-15).
Data as JSON: /api/errors/657c952d33e5341e.
Report an issue: GitHub.