[Payment Profiles] and [User Upgrades] An unexpected database error occurred.


I've been tinkering with the built-in Xenforo 2.0 "Payment Profiles" and "User Upgrades" however, I'm running into a small problem... At least when going through the process via PayPal.

The goal: The goal is to have a $5.00 monthly subscription to allow the members to become a donor, which in-tern already successfully gives them a [donor] role/tag on the forums, until canceled/terminated. They go through the process, log into their PayPal accounts, and can successfully achieve this without problem. However, on the Paypal page, after they've finished the subscription process, they are given the option to return to my website. However, when they click on that option they end up at a blank page with a small text error simply saying "An unexpected database error occurred. Please try again later."

I've asked a user to send me the URL of the page where they get this message. It appeared differently for me, perhaps because I have different permission than they do. It read as followed...

An exception occurred: [XF\Db\Exception] MySQL query error [1406]: Data too long for column 'location' at row 1 in src/XF/Db/AbstractStatement.php on line 212

XF\Db\AbstractStatement->getException() in src/XF/Db/Mysqli/Statement.php at line 196
XF\Db\Mysqli\Statement->getException() in src/XF/Db/Mysqli/Statement.php at line 78
XF\Db\Mysqli\Statement->execute() in src/XF/Db/AbstractAdapter.php at line 79
XF\Db\AbstractAdapter->query() in src/addons/Andy/UserAgent/Listener.php at line 67
call_user_func_array() in src/XF/Extension.php at line 67
XF\Extension->fire() in src/XF/App.php at line 2350
XF\App->fire() in src/XF/Pub/App.php at line 447
XF\Pub\App->renderPageHtml() in src/XF/App.php at line 1724
XF\App->renderPage() in src/XF/Mvc/Dispatcher.php at line 310
XF\Mvc\Dispatcher->render() in src/XF/Mvc/Dispatcher.php at line 44
XF\Mvc\Dispatcher->run() in src/XF/App.php at line 1889
XF\App->run() in src/XF.php at line 328
XF::runApp() in index.php at line 13

If someone can help me resolve this issue, I would be extremely grateful. I've attached screenshots of how my Payment Profiles and User Upgrades pages are set up just in-case there was something I missed or had done incorrectly.



Chris D

XenForo developer
Staff member
That particular error seems to be coming from an add on. So you’d need to consult with the author about that.

It doesn’t seem to be anything to do with the payment itself. Are there any other errors that could be related?

There is a payment provider log in the Admin CP this is where we’d log the incoming errors from PayPal if there are any.

If there aren’t any records then it suggests that PayPal isn’t attempting or isn’t able to communicate with your site for some reason.

You’d have to find the IPN log in your PayPal account to find out what they are seeing.

DragonByte Tech

Well-known member
The addon in question appears to be an UserAgent addon written by @AndyB if I'm reading the error correctly. The addon needs to either increase the "location" column length, or the input needs to be trimmed before inserting into the database.



@Chris D & @DragonByte Tech - I appreciate the help.
It was indeed "UserAgent" that was causing the issue and to be honest, I completely forgot I even had that addon installed, as it really doesn't provide anything important that I need. So I simply uninstalled it and the process now works flawlessly. This can probably be marked as problem solved!