{"record":{"id":"43da14c28caac840","repo":"SigNoz/signoz","slug":"errcodeincorrectpassword-43da14","errorCode":"ErrCodeIncorrectPassword","errorMessage":"old password is incorrect","messagePattern":"old password is incorrect","errorType":"error_code","errorClass":"errors.Error","httpStatus":400,"severity":"error","filePath":"pkg/modules/user/impluser/setter.go","lineNumber":491,"sourceCode":"\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err := user.ErrIfDeleted(); err != nil {\n\t\treturn errors.WithAdditionalf(err, \"cannot change password for deleted user\")\n\t}\n\n\tif err := user.ErrIfRoot(); err != nil {\n\t\treturn errors.WithAdditionalf(err, \"cannot change password for root user\")\n\t}\n\n\tpassword, err := module.store.GetPasswordByUserID(ctx, userID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif !password.Equals(oldpasswd) {\n\t\treturn errors.New(errors.TypeInvalidInput, types.ErrCodeIncorrectPassword, \"old password is incorrect\")\n\t}\n\n\tif err := password.Update(passwd); err != nil {\n\t\treturn err\n\t}\n\n\tif err := module.store.RunInTx(ctx, func(ctx context.Context) error {\n\t\tif err := module.store.UpdatePassword(ctx, password); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := module.store.DeleteResetPasswordTokenByPasswordID(ctx, password.ID); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\treturn nil\n\t}); err != nil {\n\t\treturn err","sourceCodeStart":473,"sourceCodeEnd":509,"githubUrl":"https://github.com/SigNoz/signoz/blob/5069bf80b08f1f00d7e014eccc09902f9871004f/pkg/modules/user/impluser/setter.go#L473-L509","documentation":"UpdatePassword verifies the current password before allowing a change; if password.Equals(oldpasswd) fails it returns ErrCodeIncorrectPassword (TypeInvalidInput).","triggerScenarios":"PUT/PATCH change-password endpoint where the supplied old/current password doesn't match the stored hash — typo, stale password, or password already changed elsewhere.","commonSituations":"User has multiple tabs/sessions and changed the password in one; password manager stored an outdated credential; copy/paste with trailing whitespace.","solutions":["Re-enter the correct current password (verify by logging in with it)","If truly forgotten, use the forgot-password/admin reset flow instead of the change-password endpoint","Trim whitespace and disable autofill interference on the old-password field"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"ok := verifyCurrentPassword(oldPassword) // e.g. re-login check\nif !ok {\n    return errors.New(\"incorrect current password\")\n}\nupdatePassword(ctx, userID, oldPassword, newPassword)","typeGuard":null,"tryCatchPattern":"err := updatePassword(ctx, userID, old, new)\nif err != nil && types.IsErrCode(err, types.ErrCodeIncorrectPassword) {\n    // re-prompt for current password, or route to forgot-password\n}","preventionTips":["Trim/validate the old-password input client-side","If login with the same password fails, route to reset flow directly"],"tags":["password","auth","validation","user-module"],"backgroundTag":"incorrect-current-password","analyzedSha":"5069bf80b08f1f00d7e014eccc09902f9871004f","analyzedAt":"2026-08-28T06:22:12.824Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}