SigNoz/signoz · error

invalid_input

invalid_input

Error message

lock is missing in the request payload

What it means

LockUnlockDashboard.UnmarshalJSON requires an explicit locked field (JSON boolean, including false). Because Locked is a *bool, absence of the key leaves it nil, which is indistinguishable from an omitted field and is rejected to prevent accidental defaulting.

Source

Thrown at pkg/types/dashboardtypes/dashboard.go:322

	}
	dashboard.Locked = lock
	dashboard.UpdatedBy = updatedBy
	dashboard.UpdatedAt = time.Now()
	return nil
}

func (lockUnlockDashboard *LockUnlockDashboard) UnmarshalJSON(src []byte) error {
	var lockUnlock struct {
		Locked *bool `json:"lock"`
	}

	err := json.Unmarshal(src, &lockUnlock)
	if err != nil {
		return err
	}

	if lockUnlock.Locked == nil {
		return errors.New(errors.TypeInvalidInput, errors.CodeInvalidInput, "lock is missing in the request payload")
	}

	lockUnlockDashboard.Locked = lockUnlock.Locked
	return nil
}

func (dashboard *Dashboard) GetWidgetQuery(startTime, endTime, widgetIndex uint64, logger *slog.Logger) (*querybuildertypesv5.QueryRangeRequest, error) {
	type dashboardData struct {
		Widgets []struct {
			PanelTypes string `json:"panelTypes"`
			Query      struct {
				Builder struct {
					QueryData          []map[string]any `json:"queryData"`
					QueryFormulas      []map[string]any `json:"queryFormulas"`
					QueryTraceOperator []map[string]any `json:"queryTraceOperator"`
				} `json:"builder"`
				ClickhouseSQL []map[string]any `json:"clickhouse_sql"`
				PromQL        []map[string]any `json:"promql"`

View on GitHub (pinned to 5069bf80b0)

Solutions

  1. Always send an explicit boolean: {"locked":false} to unlock
  2. Remove omitempty from the Locked field in client structs
  3. Check exact field name is locked (lowercase)
  4. Add payload logging to catch null/absent values

Example fix

// before
{"locked":null}
// after
{"locked":false}
Defensive patterns

Strategy: type-guard

Validate before calling

if (typeof body.locked !== 'boolean') throw new Error('locked must be an explicit boolean');

Type guard

function hasExplicitLocked(b: unknown): b is { locked: boolean } { return typeof (b as any)?.locked === 'boolean'; }

Prevention

When it happens

Trigger: PATCH/POST lock-unlock endpoint with body {} or {"locked":null} instead of {"locked":true} or {"locked":false}.

Common situations: Clients constructing payloads with omitempty that drop false values; confusion between null and false; typos in field name (lock vs locked).

Related errors


AI-assisted analysis of SigNoz/signoz@5069bf80b0 (2026-08-28). Data as JSON: /api/errors/f320b9548b7e3daf. Report an issue: GitHub.