CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Post-installation Setup and Configuration (Moderator: Dave Greenberg) »
  • Error Type: Could not find valid key.
Pages: [1]

Author Topic: Error Type: Could not find valid key.  (Read 1401 times)

damiank

  • Guest
Error Type: Could not find valid key.
June 26, 2010, 07:33:27 pm
When going through the donation process the attached error pops up.

Sorry. A non-recoverable error has occurred.

....

Error type. Could not find a valid key.

I'm someone has a resolution to this. See attachment. Thanks

Chris Burgess

  • Ask me questions
  • ****
  • Posts: 675
  • Karma: 59
Re: Error Type: Could not find valid key.
June 27, 2010, 06:44:05 pm
There are eight pages or so of existing forum threads on this specific error message, which is trying to tell you that the CiviCRM forms engine doesn't recognise the unique key you've submitted (which should match a previously generated and cached form entry).

Search for 'could not find valid key' on this forum to see the previous posts - and please post back here if you find one of those threads is particularly useful.

I'm sure (at least) one of them has a useful response from the CiviCRM team on how to deal with this error.

Based on the number of existing forum threads on this, I think it may be be a good candidate for a UI fix. Or a FAQ. Or a separate sub-forum ;)
« Last Edit: June 27, 2010, 06:58:24 pm by xurizaemon »
@xurizaemon ● www.fuzion.co.nz

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Error Type: Could not find valid key.
June 27, 2010, 11:32:16 pm
Yeap, the end user doesn't know what the key is, nor how to make it valid. And unfortunately, the error message per se doesn't tell what's the entity type (ie, is it about missing a contact id, an event id, a contribution id...)

Any idea of a better explanation ? something without "id", nor "key" ?

X+
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: Error Type: Could not find valid key.
June 28, 2010, 10:07:31 am
This error is thrown by the Controller class when it can't find OR create a form session key. Other than the "cookies disabled" issue which is described in the error text - I don't think we know why this function fails :-(. The error message could report the class name of the form we're trying to get a session key for (e.g. CRM_Contribute_Controller_Contribution), but not sure that would help debug things (and wouldn't mean anything to the end user).

We could be a bit clearer / more accurate in the last sentence ... i.e.

"Error type: Could not find or create a valid form session key."

instead of the current error text...

"Error type: Could not find a valid key."

... but not sure what else to do since other than checking cookies we don't know what to tell the end-user to "fix" things.

Note that form session handling in 3.2 has been modified to accommodate the user having different forms / records open in multiple browser tabs. This MAY result in less instances of this problem.

Would be great to hear from folks who can consistently recreate this in situations that aren't cookie-setting related - and therefore identify other causes (and fixes) for end-users.
Protect your investment in CiviCRM by  becoming a Member!

Chris Burgess

  • Ask me questions
  • ****
  • Posts: 675
  • Karma: 59
Re: Error Type: Could not find valid key.
June 28, 2010, 03:48:52 pm
Well, wouldn't you know it. Karma has decided to help me out for being a smartypants, and I'm able to reproduce this on one of our sites this morning.

I'll do some digging ... CiviCRM team, ping me on IRC if you'd like a look :)

EDIT: Looks like CRM_Core_Key::get() is returning a new key each time.

Cookies are turned on, and I'm seeing this in two separate browsers (but only as an anonymous user).

I can see the value $_SESSION['CiviCRM']['qfPrivateKey'] if I inspect it at the end of CRM_Core_Key::privateKey().

I can see the data including correct qfPrivateKey being stored in Drupal's sessions table.

But on page reload, the value is gone.

...

Somewhat embarrassingly, this was a Drupal config error. The UID for user 0 had been changed (to 397), which meant that Drupal was unable to load the anonymous user, and didn't store session data for them. In this case at least, the bug was external to CiviCRM, and due to the fact that session data wasn't being stored.

I'm pretty sure I've posted on the forums before regarding CiviCRM's session size potentially exceeding local storage (due to the way that various CiviCRM data is stored in the session). This may be what triggers the bug for some other users ... I wish I could find that post right now but I can't :S
« Last Edit: June 28, 2010, 06:47:44 pm by xurizaemon »
@xurizaemon ● www.fuzion.co.nz

markaconley

  • I’m new here
  • *
  • Posts: 21
  • Karma: 1
Error type: Could not find a valid key
August 18, 2010, 04:01:33 am
Hey Guys,

I just got this error message  -  "Error type: Could not find a valid key." 

Reading through the postings, I am not sure what the fix is or even if there is a fix. 

Can someone shed some light?

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Post-installation Setup and Configuration (Moderator: Dave Greenberg) »
  • Error Type: Could not find valid key.

This forum was archived on 2017-11-26.