Answers.Body: <p>The <code>qid</code>is the mailing queue ID, which is unique to each combination of recpient and mailing.  If you look in the database, you'll be able to work back to see which contact corresponds to the <code>qid</code>. If it's the same contact each time, you might consider excluding them or thinking about anything unique about them.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-11-16T21:06:21.487Z
Answers.Text: Thanks Andrew. Looks like these are largely junk requests with qids that are much larger than the values available in civicrm_mailing_event_queue.
Answers.UserDisplayName: BBC
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-11-11T13:42:19.207Z
Answers.LastActivityDate: 2015-11-11T13:42:19.207Z
Answers.UserDisplayName: Andie Hunt
Answers.Body: <p>You are on the right track I think.</p>
  
  <p>The error is occurring when the values for <code>jid</code>, <code>qid</code>, and <code>h</code> get validated.</p>
  
  <p><code>jid</code> is the job_id and I wouldn't expect that the 85152 is a correct value (assuming your current job_id is only up to 851 or so). Also the change in argument order, while it doesn't affect anything, there is no reason for them to get rearranged.  It almost looks like someone is trying to hack your system. (Just a WAG on my part that.) </p>
  
  <p>CiviCRM validates this by looking for matching values in the mail queue and if not found perhaps the error manifests as you are seeing. Thus, the error getting logged.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-09-11T22:06:23.543Z
Answers.LastActivityDate: 2015-09-11T22:06:23.543Z
Answers.UserDisplayName: DaveD
Answers.Body: <p>I had a bit of a look in the code-base &amp; I couldn't find any evidence of the invalid url being constructed - ie. the qid first rather than last. I'm inclined to agree with Dave that the problem is someone either deliberately or accidentally 'trying it on' with urls</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-10-11T23:22:32.813Z
Answers.LastActivityDate: 2015-10-11T23:22:32.813Z
Answers.UserDisplayName: eileen
Body: <p>I'm getting quite a few (30+ on a mailing to ~1,500 subscribers) errors like the following each time we sent out a mass email. </p>
  
  <p>I'm running CiviCRM 4.6.8 and Drupal 7.3.9, but have been seeing these errors for the last 3-4 versions. </p>
  
  <pre>
  There was a CiviCRM error at ...
  Date: 2015-09-11T08:04:10-04:00
  
  ***ERROR***
  Array
  (
      [message] => There was an error in your request
      [code] => 
  )
  
  
  ***LOGGED IN USER***
  count:              25 
  is_error:           1 
  error_message:      Expected one Contact but found 25 
  
  
  
  ***SERVER***
  PHPRC:              /etc/php5/cgi/ 
  PHP_DOCUMENT_ROOT:  /var/www/clients/client5/web8 
  PATH:               /usr/local/bin:/usr/bin:/bin 
  PWD:                /var/www/php-fcgi-scripts/web8 
  SHLVL:              0 
  PHP_FCGI_MAX_REQUESTS:5000 
  FCGI_ROLE:          RESPONDER 
  REDIRECT_SCRIPT_URL:/civicrm/mailing/optout 
  REDIRECT_SCRIPT_URI:http://www.example.org/civicrm/mailing/optout 
  REDIRECT_protossl:   
  REDIRECT_HTTP_AUTHORIZATION: 
  REDIRECT_STATUS:    200 
  SCRIPT_URL:         /civicrm/mailing/optout 
  SCRIPT_URI:         http://www.example.org/civicrm/mailing/optout 
  protossl:            
  HTTP_AUTHORIZATION:  
  HTTP_CONNECTION:    close 
  HTTP_ACCEPT:        text/html, application/xhtml+xml, */* 
  HTTP_ACCEPT_ENCODING:deflate 
  HTTP_ACCEPT_LANGUAGE:en-US 
  HTTP_HOST:          www.example.org 
  HTTP_USER_AGENT:    Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0) 
  SERVER_SIGNATURE:   Apache/2.2.22 (Ubuntu) Server at www.peatworks.org Port 80
  
  SERVER_SOFTWARE:    Apache/2.2.22 (Ubuntu) 
  SERVER_NAME:        www.example.org 
  SERVER_ADDR:        10.10.10.26 
  SERVER_PORT:        80 
  REMOTE_ADDR:        83.223.122.17 
  DOCUMENT_ROOT:      /var/www/example.org/web 
  SERVER_ADMIN:       webmaster@example.org 
  SCRIPT_FILENAME:    /var/www/example.org/web/index.php 
  REMOTE_PORT:        47487 
  REDIRECT_QUERY_STRING:qid=2118352&h=033856psn51n67or41&jid=85152&reset=1 
  REDIRECT_URL:       /civicrm/mailing/optout 
  GATEWAY_INTERFACE:  CGI/1.1 
  SERVER_PROTOCOL:    HTTP/1.1 
  REQUEST_METHOD:     GET 
  QUERY_STRING:       qid=2118352&h=033856psn51n67or41&jid=85152&reset=1 
  REQUEST_URI:        /civicrm/mailing/optout?qid=2118352&h=033856psn51n67or41&jid=85152&reset=1 
  SCRIPT_NAME:        /index.php 
  PHP_SELF:           /index.php 
  REQUEST_TIME:       1441973050 
  HTTP_REFERER:        
  
  
  
  ***BACKTRACE***
  #0 /var/www/clients/client5/web8/web/sites/default/files/civicrm/extensions/ca.bidon.reporterror/reporterror.php(207): reporterror_civicrm_generatereport("Partnership on Employment and Accessible Technology (PEAT)", (Array:2), NULL)
  #1 /var/www/clients/client5/web8/web/sites/all/modules/civicrm/CRM/Core/Error.php(351): reporterror_civicrm_handler((Array:2))
  #2 /var/www/clients/client5/web8/web/sites/all/modules/civicrm/CRM/Mailing/Form/Optout.php(55): CRM_Core_Error::fatal("There was an error in your request")
  #3 /var/www/clients/client5/web8/web/sites/all/modules/civicrm/CRM/Core/Form.php(455): CRM_Mailing_Form_Optout->preProcess()
  #4 /var/www/clients/client5/web8/web/sites/all/modules/civicrm/CRM/Core/QuickForm/Action/Display.php(94): CRM_Core_Form->buildForm()
  #5 /var/www/clients/client5/web8/web/sites/all/modules/civicrm/packages/HTML/QuickForm/Controller.php(203): CRM_Core_QuickForm_Action_Display->perform(Object(CRM_Mailing_Form_Optout), "display")
  #6 /var/www/clients/client5/web8/web/sites/all/modules/civicrm/packages/HTML/QuickForm/Page.php(103): HTML_QuickForm_Controller->handle(Object(CRM_Mailing_Form_Optout), "display")
  #7 /var/www/clients/client5/web8/web/sites/all/modules/civicrm/CRM/Core/Controller.php(353): HTML_QuickForm_Page->handle("display")
  #8 /var/www/clients/client5/web8/web/sites/all/modules/civicrm/CRM/Utils/Wrapper.php(115): CRM_Core_Controller->run()
  #9 /var/www/clients/client5/web8/web/sites/all/modules/civicrm/CRM/Core/Invoke.php(286): CRM_Utils_Wrapper->run("CRM_Mailing_Form_Optout", "Opt-out", NULL)
  #10 /var/www/clients/client5/web8/web/sites/all/modules/civicrm/CRM/Core/Invoke.php(86): CRM_Core_Invoke::runItem((Array:15))
  #11 /var/www/clients/client5/web8/web/sites/all/modules/civicrm/CRM/Core/Invoke.php(54): CRM_Core_Invoke::_invoke((Array:3))
  #12 /var/www/clients/client5/web8/web/sites/all/modules/civicrm/drupal/civicrm.module(489): CRM_Core_Invoke::invoke((Array:3))
  #13 [internal function](): civicrm_invoke("mailing", "optout")
  #14 /var/www/clients/client5/web8/web/includes/menu.inc(519): call_user_func_array("civicrm_invoke", (Array:2))
  #15 /var/www/clients/client5/web8/web/index.php(21): menu_execute_active_handler()
  #16 {main}
  </pre>
  
  <p>I am seeing a few successful optout and unsubscribes for each mailing, but am trying to figure out if the above is a cause for concern. </p>
  
  <p>Comparing the REQUEST_URI to valid optout and unsubscribe requests, It looks like some of the query parameter values may be getting mangled, but I'm unsure about what these parameters related to.</p>
  
  <p>civicrm/mailing/optout?reset=1&amp;jid=851&amp;qid=19765&amp;h=04b9e8b8620d6650 (works)</p>
  
  <p>civicrm/mailing/optout?qid=2118352&amp;h=033856psn51n67or41&amp;jid=85152&amp;reset=1 (doesn't work)</p>
  
  <p>I'm not sure why the order is different between the two, but noted that jid=851  is consistent across multiple optout links that work correctly. It also seems that each query parameter contains a couple of extra characters when compared to a functioning link.</p>
  
  <p>Any theories about what might be going on here or where the extra characters in the query parameters may be coming from? </p>
  
  <p>Also, if these are legitimate unsubscribe/optout requests, is there a way I can trace the query parameters back to the original user?</p>
  
Tags: <civimail><error-page>
Title: Expected one Contact but found 25
ThreadText: # Expected one Contact but found 25
  
  (Asked by: username_0 on 2015-09-11)
  
  I'm getting quite a few (30+ on a mailing to ~1,500 subscribers) errors like the following each time we sent out a mass email.
  
  I'm running CiviCRM 4.6.8 and Drupal 7.3.9, but have been seeing these errors for the last 3-4 versions.
  
  ```
  
  There was a CiviCRM error at ...
  Date: 2015-09-11T08:04:10-04:00
  
  ***ERROR***
  Array
  (
      [message] => There was an error in your request
      [code] => 
  )
  
  ***LOGGED IN USER***
  count:              25 
  is_error:           1 
  error_message:      Expected one Contact but found 25 
  
  ***SERVER***
  PHPRC:              /etc/php5/cgi/ 
  PHP_DOCUMENT_ROOT:  /var/www/clients/client5/web8 
  PATH:               /usr/local/bin:/usr/bin:/bin 
  PWD:                /var/www/php-fcgi-scripts/web8 
  SHLVL:              0 
  PHP_FCGI_MAX_REQUESTS:5000 
  FCGI_ROLE:          RESPONDER 
  REDIRECT_SCRIPT_URL:/civicrm/mailing/optout 
  REDIRECT_SCRIPT_URI:http://www.example.org/civicrm/mailing/optout 
  REDIRECT_protossl:   
  REDIRECT_HTTP_AUTHORIZATION: 
  REDIRECT_STATUS:    200 
  SCRIPT_URL:         /civicrm/mailing/optout 
  SCRIPT_URI:         http://www.example.org/civicrm/mailing/optout 
  protossl:            
  HTTP_AUTHORIZATION:  
  HTTP_CONNECTION:    close 
  HTTP_ACCEPT:        text/html, application/xhtml+xml, */* 
  HTTP_ACCEPT_ENCODING:deflate 
  HTTP_ACCEPT_LANGUAGE:en-US 
  HTTP_HOST:          www.example.org 
  HTTP_USER_AGENT:    Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0) 
  SERVER_SIGNATURE:   Apache/2.2.22 (Ubuntu) Server at www.peatworks.org Port 80
  
  SERVER_SOFTWARE:    Apache/2.2.22 (Ubuntu) 
  SERVER_NAME:        www.example.org 
  SERVER_ADDR:        10.10.10.26 
  SERVER_PORT:        80 
  REMOTE_ADDR:        83.223.122.17 
  DOCUMENT_ROOT:      /var/www/example.org/web 
  SERVER_ADMIN:       webmaster@example.org 
  SCRIPT_FILENAME:    /var/www/example.org/web/index.php 
  REMOTE_PORT:        47487 
  REDIRECT_QUERY_STRING:qid=2118352&h=033856psn51n67or41&jid=85152&reset=1 
  REDIRECT_URL:       /civicrm/mailing/optout 
  GATEWAY_INTERFACE:  CGI/1.1 
  SERVER_PROTOCOL:    HTTP/1.1 
  REQUEST_METHOD:     GET 
  QUERY_STRING:       qid=2118352&h=033856psn51n67or41&jid=85152&reset=1 
  REQUEST_URI:        /civicrm/mailing/optout?qid=2118352&h=033856psn51n67or41&jid=85152&reset=1 
  SCRIPT_NAME:        /index.php 
  PHP_SELF:           /index.php 
  REQUEST_TIME:       1441973050 
  HTTP_REFERER:        
  
  ***BACKTRACE***
  #0 /var/www/clients/client5/web8/web/sites/default/files/civicrm/extensions/ca.bidon.reporterror/reporterror.php(207): reporterror_civicrm_generatereport("Partnership on Employment and Accessible Technology (PEAT)", (Array:2), NULL)
  #1 /var/www/clients/client5/web8/web/sites/all/modules/civicrm/CRM/Core/Error.php(351): reporterror_civicrm_handler((Array:2))
  #2 /var/www/clients/client5/web8/web/sites/all/modules/civicrm/CRM/Mailing/Form/Optout.php(55): CRM_Core_Error::fatal("There was an error in your request")
  #3 /var/www/clients/client5/web8/web/sites/all/modules/civicrm/CRM/Core/Form.php(455): CRM_Mailing_Form_Optout->preProcess()
  #4 /var/www/clients/client5/web8/web/sites/all/modules/civicrm/CRM/Core/QuickForm/Action/Display.php(94): CRM_Core_Form->buildForm()
  #5 /var/www/clients/client5/web8/web/sites/all/modules/civicrm/packages/HTML/QuickForm/Controller.php(203): CRM_Core_QuickForm_Action_Display->perform(Object(CRM_Mailing_Form_Optout), "display")
  #6 /var/www/clients/client5/web8/web/sites/all/modules/civicrm/packages/HTML/QuickForm/Page.php(103): HTML_QuickForm_Controller->handle(Object(CRM_Mailing_Form_Optout), "display")
  #7 /var/www/clients/client5/web8/web/sites/all/modules/civicrm/CRM/Core/Controller.php(353): HTML_QuickForm_Page->handle("display")
  #8 /var/www/clients/client5/web8/web/sites/all/modules/civicrm/CRM/Utils/Wrapper.php(115): CRM_Core_Controller->run()
  #9 /var/www/clients/client5/web8/web/sites/all/modules/civicrm/CRM/Core/Invoke.php(286): CRM_Utils_Wrapper->run("CRM_Mailing_Form_Optout", "Opt-out", NULL)
  #10 /var/www/clients/client5/web8/web/sites/all/modules/civicrm/CRM/Core/Invoke.php(86): CRM_Core_Invoke::runItem((Array:15))
  #11 /var/www/clients/client5/web8/web/sites/all/modules/civicrm/CRM/Core/Invoke.php(54): CRM_Core_Invoke::_invoke((Array:3))
  #12 /var/www/clients/client5/web8/web/sites/all/modules/civicrm/drupal/civicrm.module(489): CRM_Core_Invoke::invoke((Array:3))
  #13 [internal function](): civicrm_invoke("mailing", "optout")
  #14 /var/www/clients/client5/web8/web/includes/menu.inc(519): call_user_func_array("civicrm_invoke", (Array:2))
  #15 /var/www/clients/client5/web8/web/index.php(21): menu_execute_active_handler()
  #16 {main}
  
  ```
  
  I am seeing a few successful optout and unsubscribes for each mailing, but am trying to figure out if the above is a cause for concern.
  
  Comparing the REQUEST\_URI to valid optout and unsubscribe requests, It looks like some of the query parameter values may be getting mangled, but I'm unsure about what these parameters related to.
  
  civicrm/mailing/optout?reset=1&jid=851&qid=19765&h=04b9e8b8620d6650 (works)
  
  civicrm/mailing/optout?qid=2118352&h=033856psn51n67or41&jid=85152&reset=1 (doesn't work)
  
  I'm not sure why the order is different between the two, but noted that jid=851 is consistent across multiple optout links that work correctly. It also seems that each query parameter contains a couple of extra characters when compared to a functioning link.
  
  Any theories about what might be going on here or where the extra characters in the query parameters may be coming from?
  
  Also, if these are legitimate unsubscribe/optout requests, is there a way I can trace the query parameters back to the original user?
  
  **Tags:** civimail, error-page
  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_1 on 2015-11-11. Score: 1 | Accepted answer
  
  The `qid`is the mailing queue ID, which is unique to each combination of recpient and mailing. If you look in the database, you'll be able to work back to see which contact corresponds to the `qid`. If it's the same contact each time, you might consider excluding them or thinking about anything unique about them.
  
  > **Comments:**
  > **username_0**: Thanks Andrew. Looks like these are largely junk requests with qids that are much larger than the values available in civicrm_mailing_event_queue.  
  
  ---
  
  ### Answer by username_2 on 2015-09-11. Score: 1
  
  You are on the right track I think.
  
  The error is occurring when the values for `jid`, `qid`, and `h` get validated.
  
  `jid` is the job\_id and I wouldn't expect that the 85152 is a correct value (assuming your current job\_id is only up to 851 or so). Also the change in argument order, while it doesn't affect anything, there is no reason for them to get rearranged. It almost looks like someone is trying to hack your system. (Just a WAG on my part that.)
  
  CiviCRM validates this by looking for matching values in the mail queue and if not found perhaps the error manifests as you are seeing. Thus, the error getting logged.
  
  
  ---
  
  ### Answer by username_3 on 2015-10-11. Score: 0
  
  I had a bit of a look in the code-base & I couldn't find any evidence of the invalid url being constructed - ie. the qid first rather than last. I'm inclined to agree with Dave that the problem is someone either deliberately or accidentally 'trying it on' with urls
  
  
  ---
  
  