SigNoz/signoz · warning
ErrCodePublicDashboardInvalidInput
ErrCodePublicDashboardInvalidInput
Error message
widget index is missing from the path
What it means
The public dashboard widget query-range handler requires a widget index path variable ({idx}) in the route. When the mux route match does not include the 'idx' variable, the handler rejects the request with ErrCodePublicDashboardInvalidInput.
Source
Thrown at pkg/modules/dashboard/impldashboard/handler.go:160
return
}
render.Success(rw, http.StatusOK, gettablePublicDashboardData)
}
func (handler *handler) GetPublicWidgetQueryRange(rw http.ResponseWriter, r *http.Request) {
ctx, cancel := context.WithTimeout(r.Context(), 10*time.Second)
defer cancel()
id, err := valuer.NewUUID(mux.Vars(r)["id"])
if err != nil {
render.Error(rw, err)
return
}
widgetIndex, ok := mux.Vars(r)["idx"]
if !ok {
render.Error(rw, errors.New(errors.TypeInvalidInput, dashboardtypes.ErrCodePublicDashboardInvalidInput, "widget index is missing from the path"))
return
}
dashboard, err := handler.module.GetDashboardByPublicID(ctx, id)
if err != nil {
render.Error(rw, err)
return
}
publicDashboard, err := handler.module.GetPublic(ctx, dashboard.OrgID, valuer.MustNewUUID(dashboard.ID))
if err != nil {
render.Error(rw, err)
return
}
widgetIdx, err := strconv.ParseUint(widgetIndex, 10, 64)
if err != nil {
render.Error(rw, errors.New(errors.TypeInvalidInput, dashboardtypes.ErrCodePublicDashboardInvalidInput, "invalid widget index"))View on GitHub (pinned to 5069bf80b0)
Solutions
- Include the widget index segment in the request URL (e.g. /public/{id}/3/query_range)
- Verify the route pattern contains {idx}
- Check gateway/ingress rewrite rules are not dropping the path segment
Example fix
// before
GET /api/v1/dashboards/{publicID}/query_range
// after
GET /api/v1/dashboards/{publicID}/3/query_range Defensive patterns
Strategy: validation
Validate before calling
const idxRe = /^\d+$/;
function buildWidgetURL(publicId, idx) {
if (idx === undefined || idx === null || !idxRe.test(String(idx))) {
throw new Error('widget index required');
}
return `/api/v1/dashboards/${publicId}/${idx}/query_range`;
} Type guard
function isValidWidgetIndex(idx) {
return typeof idx === 'number' && Number.isInteger(idx) && idx >= 0;
} Try / catch
try { const res = await fetch(url); } catch (e) { /* network */ }
if (res.status === 400 && body.code === 'public_dashboard_invalid_input') { /* rebuild URL with idx */ } Prevention
- Centralize public dashboard URL construction in one helper
- Add integration tests asserting the {idx} route segment
When it happens
Trigger: Issuing GET on a public dashboard widget metrics URL where the {idx} path segment is absent or the route was registered without the {idx} placeholder, so mux.Vars(r)['idx'] is missing.
Common situations: Route registered as /api/v1/query_range instead of /api/v1/{idx}/query_range; client building the URL without appending the widget index; reverse proxy or router rewrite stripping the path segment.
Related errors
- public_dashboard_invalid_input
- ErrCodeRoleInvalidInput
- invalid_input
- invalid_input
- dashboard_invalid_patch
AI-assisted analysis of SigNoz/signoz@5069bf80b0 (2026-08-28).
Data as JSON: /api/errors/d2be5b239b3c7e28.
Report an issue: GitHub.