{"record":{"id":"40986234b7524001","repo":"SigNoz/signoz","slug":"codeinvalidinput-409862","errorCode":"CodeInvalidInput","errorMessage":"email is required","messagePattern":"email is required","errorType":"validation","errorClass":"errors SigNozError","httpStatus":400,"severity":"error","filePath":"pkg/types/authtypes/email_password.go","lineNumber":25,"sourceCode":"\t\"github.com/SigNoz/signoz/pkg/valuer\"\n)\n\ntype PostableEmailPasswordSession struct {\n\tEmail    valuer.Email `json:\"email\"`\n\tPassword string       `json:\"password\"`\n\tOrgID    valuer.UUID  `json:\"orgId\"`\n}\n\nfunc (typ *PostableEmailPasswordSession) UnmarshalJSON(data []byte) error {\n\ttype Alias PostableEmailPasswordSession\n\tvar temp Alias\n\n\tif err := json.Unmarshal(data, &temp); err != nil {\n\t\treturn err\n\t}\n\n\tif temp.Email.IsZero() {\n\t\treturn errors.New(errors.TypeInvalidInput, errors.CodeInvalidInput, \"email is required\")\n\t}\n\n\tif temp.Password == \"\" {\n\t\treturn errors.New(errors.TypeInvalidInput, errors.CodeInvalidInput, \"password is required\")\n\t}\n\n\tif temp.OrgID.IsZero() {\n\t\treturn errors.New(errors.TypeInvalidInput, errors.CodeInvalidInput, \"orgID is required\")\n\t}\n\n\t*typ = PostableEmailPasswordSession(temp)\n\treturn nil\n}\n","sourceCodeStart":7,"sourceCodeEnd":39,"githubUrl":"https://github.com/SigNoz/signoz/blob/5069bf80b08f1f00d7e014eccc09902f9871004f/pkg/types/authtypes/email_password.go#L7-L39","documentation":"Returned by PostableEmailPasswordSession.UnmarshalJSON when the decoded JSON lacks an email field. This type models an email+password login/session payload, and email is the mandatory identifier. The error fires before password/orgID checks.","triggerScenarios":"POSTing a JSON auth payload without an email field (or with an empty/zero email) that unmarshals into PostableEmailPasswordSession.","commonSituations":"Frontend sends {password, orgID} only, field named differently (emailAddress/user), or empty string email from an unbound form input.","solutions":["Include a non-empty \"email\" field in the JSON payload","Check for field-name mismatch between client and API (email vs emailAddress/user)","Validate the request body client-side before submitting"],"exampleFix":"// before\n{\"password\": \"secret\", \"orgID\": \"org1\"}\n// after\n{\"email\": \"user@example.com\", \"password\": \"secret\", \"orgID\": \"org1\"}","handlingStrategy":"validation","validationCode":"type creds = { email?: string; password?: string; orgID?: string };\nfunction validate(c: creds): string | null {\n  if (!c.email?.trim()) return \"email is required\";\n  return null;\n}","typeGuard":"function hasEmail(c: unknown): c is { email: string } {\n  return typeof c === \"object\" && c !== null && typeof (c as any).email === \"string\" && (c as any).email.trim() !== \"\";\n}","tryCatchPattern":"try { await api.login(payload); } catch (e) { if (String(e).includes(\"email is required\")) setFieldError(\"email\", \"Email is required\"); else throw e; }","preventionTips":["Require email client-side before submit","Use consistent field names between client and server contract"],"tags":["auth","json-validation","email","invalid-input"],"backgroundTag":"missing-required-json-field","analyzedSha":"5069bf80b08f1f00d7e014eccc09902f9871004f","analyzedAt":"2026-08-28T06:22:12.824Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}