SigNoz/signoz · error · errors SigNozError

CodeInvalidInput

CodeInvalidInput

Error message

email is required

What it means

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.

Source

Thrown at pkg/types/authtypes/email_password.go:25

	"github.com/SigNoz/signoz/pkg/valuer"
)

type PostableEmailPasswordSession struct {
	Email    valuer.Email `json:"email"`
	Password string       `json:"password"`
	OrgID    valuer.UUID  `json:"orgId"`
}

func (typ *PostableEmailPasswordSession) UnmarshalJSON(data []byte) error {
	type Alias PostableEmailPasswordSession
	var temp Alias

	if err := json.Unmarshal(data, &temp); err != nil {
		return err
	}

	if temp.Email.IsZero() {
		return errors.New(errors.TypeInvalidInput, errors.CodeInvalidInput, "email is required")
	}

	if temp.Password == "" {
		return errors.New(errors.TypeInvalidInput, errors.CodeInvalidInput, "password is required")
	}

	if temp.OrgID.IsZero() {
		return errors.New(errors.TypeInvalidInput, errors.CodeInvalidInput, "orgID is required")
	}

	*typ = PostableEmailPasswordSession(temp)
	return nil
}

View on GitHub (pinned to 5069bf80b0)

Solutions

  1. Include a non-empty "email" field in the JSON payload
  2. Check for field-name mismatch between client and API (email vs emailAddress/user)
  3. Validate the request body client-side before submitting

Example fix

// before
{"password": "secret", "orgID": "org1"}
// after
{"email": "user@example.com", "password": "secret", "orgID": "org1"}
Defensive patterns

Strategy: validation

Validate before calling

type creds = { email?: string; password?: string; orgID?: string };
function validate(c: creds): string | null {
  if (!c.email?.trim()) return "email is required";
  return null;
}

Type guard

function hasEmail(c: unknown): c is { email: string } {
  return typeof c === "object" && c !== null && typeof (c as any).email === "string" && (c as any).email.trim() !== "";
}

Try / catch

try { await api.login(payload); } catch (e) { if (String(e).includes("email is required")) setFieldError("email", "Email is required"); else throw e; }

Prevention

When it happens

Trigger: POSTing a JSON auth payload without an email field (or with an empty/zero email) that unmarshals into PostableEmailPasswordSession.

Common situations: Frontend sends {password, orgID} only, field named differently (emailAddress/user), or empty string email from an unbound form input.

Related errors


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