SigNoz/signoz · error · errors.Error

CodeInvalidInput

CodeInvalidInput

Error message

user::password::reset::max_token_lifetime must be positive

What it means

User module config validation requires user::password::reset::max_token_lifetime to be a positive duration. Validate() rejects the config at startup/parse time with CodeInvalidInput when it is zero or negative.

Source

Thrown at pkg/modules/user/config.go:69

				AllowSelf:        false,
				MaxTokenLifetime: 6 * time.Hour,
			},
			Invite: InviteConfig{
				MaxTokenLifetime: 48 * time.Hour,
			},
		},
		Root: RootConfig{
			Enabled: false,
			Org: OrgConfig{
				Name: "default",
			},
		},
	}
}

func (c Config) Validate() error {
	if c.Password.Reset.MaxTokenLifetime <= 0 {
		return errors.New(errors.TypeInvalidInput, errors.CodeInvalidInput, "user::password::reset::max_token_lifetime must be positive")
	}

	if c.Password.Invite.MaxTokenLifetime <= 0 {
		return errors.New(errors.TypeInvalidInput, errors.CodeInvalidInput, "user::password::invite::max_token_lifetime must be positive")
	}

	if c.Root.Enabled {
		if c.Root.Email.IsZero() {
			return errors.New(errors.TypeInvalidInput, errors.CodeInvalidInput, "user::root::email is required when root user is enabled")
		}
		if c.Root.Password == "" {
			return errors.New(errors.TypeInvalidInput, errors.CodeInvalidInput, "user::root::password is required when root user is enabled")
		}
		if !types.IsPasswordValid(c.Root.Password) {
			return errors.New(errors.TypeInvalidInput, errors.CodeInvalidInput, "user::root::password does not meet password requirements")
		}
	}

View on GitHub (pinned to 5069bf80b0)

Solutions

  1. Set a positive duration, e.g. max_token_lifetime: 24h
  2. Ensure the YAML key path password.reset.max_token_lifetime matches the struct
  3. Check that duration strings include units (h/m/s) so they parse to non-zero values

Example fix

// before
password:
  reset:
    max_token_lifetime: 0s
// after
password:
  reset:
    max_token_lifetime: 24h
Defensive patterns

Strategy: validation

Validate before calling

if cfg.Password.Reset.MaxTokenLifetime <= 0 {
    cfg.Password.Reset.MaxTokenLifetime = 24 * time.Hour // or fail fast
}

Try / catch

if err := cfg.Validate(); err != nil {
    log.Fatal("invalid user config", "err", err)
}

Prevention

When it happens

Trigger: Loading user module Config with Password.Reset.MaxTokenLifetime unset (zero value) or explicitly <= 0.

Common situations: Partial YAML/env config after upgrading, removing the key while relying on defaults, or misparsing duration strings (e.g. '90' without a unit).

Understand the failure class

Background: Config validation failed: what "invalid value for {key}" and settings-rejection errors mean across 19 open-source libraries — this error's family across 19 libraries.

Related errors


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