{"record":{"id":"f320b9548b7e3daf","repo":"SigNoz/signoz","slug":"invalid-input-f320b9","errorCode":"invalid_input","errorMessage":"lock is missing in the request payload","messagePattern":"lock is missing in the request payload","errorType":"validation","errorClass":null,"httpStatus":400,"severity":"error","filePath":"pkg/types/dashboardtypes/dashboard.go","lineNumber":322,"sourceCode":"\t}\n\tdashboard.Locked = lock\n\tdashboard.UpdatedBy = updatedBy\n\tdashboard.UpdatedAt = time.Now()\n\treturn nil\n}\n\nfunc (lockUnlockDashboard *LockUnlockDashboard) UnmarshalJSON(src []byte) error {\n\tvar lockUnlock struct {\n\t\tLocked *bool `json:\"lock\"`\n\t}\n\n\terr := json.Unmarshal(src, &lockUnlock)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif lockUnlock.Locked == nil {\n\t\treturn errors.New(errors.TypeInvalidInput, errors.CodeInvalidInput, \"lock is missing in the request payload\")\n\t}\n\n\tlockUnlockDashboard.Locked = lockUnlock.Locked\n\treturn nil\n}\n\nfunc (dashboard *Dashboard) GetWidgetQuery(startTime, endTime, widgetIndex uint64, logger *slog.Logger) (*querybuildertypesv5.QueryRangeRequest, error) {\n\ttype dashboardData struct {\n\t\tWidgets []struct {\n\t\t\tPanelTypes string `json:\"panelTypes\"`\n\t\t\tQuery      struct {\n\t\t\t\tBuilder struct {\n\t\t\t\t\tQueryData          []map[string]any `json:\"queryData\"`\n\t\t\t\t\tQueryFormulas      []map[string]any `json:\"queryFormulas\"`\n\t\t\t\t\tQueryTraceOperator []map[string]any `json:\"queryTraceOperator\"`\n\t\t\t\t} `json:\"builder\"`\n\t\t\t\tClickhouseSQL []map[string]any `json:\"clickhouse_sql\"`\n\t\t\t\tPromQL        []map[string]any `json:\"promql\"`","sourceCodeStart":304,"sourceCodeEnd":340,"githubUrl":"https://github.com/SigNoz/signoz/blob/5069bf80b08f1f00d7e014eccc09902f9871004f/pkg/types/dashboardtypes/dashboard.go#L304-L340","documentation":"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.","triggerScenarios":"PATCH/POST lock-unlock endpoint with body {} or {\"locked\":null} instead of {\"locked\":true} or {\"locked\":false}.","commonSituations":"Clients constructing payloads with omitempty that drop false values; confusion between null and false; typos in field name (lock vs locked).","solutions":["Always send an explicit boolean: {\"locked\":false} to unlock","Remove omitempty from the Locked field in client structs","Check exact field name is locked (lowercase)","Add payload logging to catch null/absent values"],"exampleFix":"// before\n{\"locked\":null}\n// after\n{\"locked\":false}\n","handlingStrategy":"type-guard","validationCode":"if (typeof body.locked !== 'boolean') throw new Error('locked must be an explicit boolean');","typeGuard":"function hasExplicitLocked(b: unknown): b is { locked: boolean } { return typeof (b as any)?.locked === 'boolean'; }","tryCatchPattern":null,"preventionTips":["Never use omitempty on tri-state booleans","Distinguish null vs false explicitly in client models"],"tags":["dashboard","json","boolean-handling","validation","go"],"backgroundTag":"missing-required-attribute","analyzedSha":"5069bf80b08f1f00d7e014eccc09902f9871004f","analyzedAt":"2026-08-28T06:22:12.824Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}