{"record":{"id":"949184f8bdc83053","repo":"SigNoz/signoz","slug":"codeinvalidinput-949184","errorCode":"CodeInvalidInput","errorMessage":"user::password::reset::max_token_lifetime must be positive","messagePattern":"user::password::reset::max_token_lifetime must be positive","errorType":"validation","errorClass":"errors.Error","httpStatus":400,"severity":"error","filePath":"pkg/modules/user/config.go","lineNumber":69,"sourceCode":"\t\t\t\tAllowSelf:        false,\n\t\t\t\tMaxTokenLifetime: 6 * time.Hour,\n\t\t\t},\n\t\t\tInvite: InviteConfig{\n\t\t\t\tMaxTokenLifetime: 48 * time.Hour,\n\t\t\t},\n\t\t},\n\t\tRoot: RootConfig{\n\t\t\tEnabled: false,\n\t\t\tOrg: OrgConfig{\n\t\t\t\tName: \"default\",\n\t\t\t},\n\t\t},\n\t}\n}\n\nfunc (c Config) Validate() error {\n\tif c.Password.Reset.MaxTokenLifetime <= 0 {\n\t\treturn errors.New(errors.TypeInvalidInput, errors.CodeInvalidInput, \"user::password::reset::max_token_lifetime must be positive\")\n\t}\n\n\tif c.Password.Invite.MaxTokenLifetime <= 0 {\n\t\treturn errors.New(errors.TypeInvalidInput, errors.CodeInvalidInput, \"user::password::invite::max_token_lifetime must be positive\")\n\t}\n\n\tif c.Root.Enabled {\n\t\tif c.Root.Email.IsZero() {\n\t\t\treturn errors.New(errors.TypeInvalidInput, errors.CodeInvalidInput, \"user::root::email is required when root user is enabled\")\n\t\t}\n\t\tif c.Root.Password == \"\" {\n\t\t\treturn errors.New(errors.TypeInvalidInput, errors.CodeInvalidInput, \"user::root::password is required when root user is enabled\")\n\t\t}\n\t\tif !types.IsPasswordValid(c.Root.Password) {\n\t\t\treturn errors.New(errors.TypeInvalidInput, errors.CodeInvalidInput, \"user::root::password does not meet password requirements\")\n\t\t}\n\t}\n","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/SigNoz/signoz/blob/5069bf80b08f1f00d7e014eccc09902f9871004f/pkg/modules/user/config.go#L51-L87","documentation":"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.","triggerScenarios":"Loading user module Config with Password.Reset.MaxTokenLifetime unset (zero value) or explicitly <= 0.","commonSituations":"Partial YAML/env config after upgrading, removing the key while relying on defaults, or misparsing duration strings (e.g. '90' without a unit).","solutions":["Set a positive duration, e.g. max_token_lifetime: 24h","Ensure the YAML key path password.reset.max_token_lifetime matches the struct","Check that duration strings include units (h/m/s) so they parse to non-zero values"],"exampleFix":"// before\npassword:\n  reset:\n    max_token_lifetime: 0s\n// after\npassword:\n  reset:\n    max_token_lifetime: 24h","handlingStrategy":"validation","validationCode":"if cfg.Password.Reset.MaxTokenLifetime <= 0 {\n    cfg.Password.Reset.MaxTokenLifetime = 24 * time.Hour // or fail fast\n}","typeGuard":null,"tryCatchPattern":"if err := cfg.Validate(); err != nil {\n    log.Fatal(\"invalid user config\", \"err\", err)\n}","preventionTips":["Always set explicit positive lifetimes in config templates","Validate config in CI/tests before deploy","Use duration strings with units (24h, not 24)"],"tags":["user","config","validation","token-lifetime","go"],"backgroundTag":"config-validation-failed","analyzedSha":"5069bf80b08f1f00d7e014eccc09902f9871004f","analyzedAt":"2026-08-28T06:22:12.824Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}