Unexpected Error & SQL State[21000] Error

Hello! I have been using Xibo since 2015 and I have never had to ask for support until now. KUDOS and THANKS! (We love it!!!)

We just recently upgraded from 1.7.5 to 1.8.2 and I am seeing a couple errors I have never seen before. I found a support thread on this: Removing an image from library => Unexpected Error, please contact support

However, I am on 1.8.2 and without docker so I wanted to make sure that the solution in this post would still work for us.

This is happening in a couple of layouts where there is only one image displaying per day. After troubleshooting, the error is only displaying when “Delete old version?” is checked when replacing the media. However, the display just sits on refreshing content forever until I try and delete the media and layout and start over…

When I go in and delete the media, I get an “Unexpected Error: Please contact support”.

My current work around is going into the server library and deleting the media manually, then deleting the layout, recreating the layout and rescheduling. I manage 40+ displays at this time and I need to cut out as much manual work as possible. If the solution will work in my version with no docker, I will happily make the changes. I just don’t want to make any changes with the SQL without verification.


You could consider upgrading to 1.8.3 and confirming that the issue persist there.

Is the DocumentRoot and URL rewriting configured correctly? https://xibo.org.uk/manual/en/install_environment.html

CMS permissions to the library, library path itself is fully qualified etc?

You could also enable auditing in the CMS (on Report Fault page or in CMS Settings), recreate the issue and check the log page - there should be more detailed error message there about that, which should help us understand if it’s similar issue as in the topic you mentioned or something else.

Thanks Peter!

I am still in the process of upgrading the rest of my displays to 1.8.2 from 1.7.5. It would take me another 3 months to upgrade to 1.8.3. else I would keep up with every upgrade as they come.

The DocumentRoot and Rewriting are configured correctly and the library path is fully qualified.

I collected the error log but I do not see anymore details than what the error on the page already told me. I honestly am not sure what half of this means! :confounded:

Can I email this log to you? Unfortunately, I cannot upload anything internal.


I’d expect there to be some logs around the ‘Unexpected Error: Please contact support’ message on the Logs page, assuming that auditing was enabled when you recreated the problem.

As for logs, you can upload it to dropbox/googleDrive or similar service of your choice and share the link with me via private message here please.

Thanks Peter - I sent it. Let me know if you have any troubles.

I am still receiving this error and I am curious if it could be from exporting layouts from 1.7.5 to 1.8.2. Could this have caused a mess up with the database? Exact errors from the CMS are below.

I have went into the back end and deleted media & layouts manually - Still the issue persists without a specific pattern. It just happens randomly.

Also, after manually deleting the media, they are still showing up in the CMS. I try and delete them out of the CMS and get an unexpected error.

I am in the process of getting a new server to test upgrading to 1.8.3 but I have a feeling it isn’t necessary.

Just at a loss right now but I will keep working on it and see what fixes it the least invasive way possible.

SQLSTATE[21000]: Cardinality violation: 1242 Subquery returns more than 1 row#0 C:\PHP Files\lib\Storage\PdoStorageService.php(228): PDOStatement->execute(Array)
#1 C:\PHP Files\lib\Factory\MediaFactory.php(677): Xibo\Storage\PdoStorageService->select(’\n SE…’, Array)
#2 C:\PHP Files\lib\Factory\MediaFactory.php(304): Xibo\Factory\MediaFactory->query(NULL, Array)
#3 C:\PHP Files\lib\Entity\Media.php(582): Xibo\Factory\MediaFactory->getParentById(193)
#4 C:\PHP Files\lib\Controller\Library.php(539): Xibo\Entity\Media->delete()
#5 [internal function]: Xibo\Controller\Library->delete(‘193’)
#6 C:\PHP Files\vendor\akrabat\rka-slim-controller\RKA\Slim.php(79): call_user_func_array(Array, Array)
#7 [internal function]: RKA\Slim->RKA{closure}(‘193’)
#8 C:\PHP Files\vendor\slim\slim\Slim\Route.php(468): call_user_func_array(Object(Closure), Array)
#9 C:\PHP Files\vendor\slim\slim\Slim\Slim.php(1357): Slim\Route->dispatch()
#10 C:\PHP Files\vendor\slim\slim\Slim\Middleware\Flash.php(85): Slim\Slim->call()
#11 C:\PHP Files\vendor\slim\slim\Slim\Middleware\MethodOverride.php(92): Slim\Middleware\Flash->call()
#12 C:\PHP Files\lib\Middleware\Actions.php(142): Slim\Middleware\MethodOverride->call()
#13 C:\PHP Files\lib\Middleware\Theme.php(35): Xibo\Middleware\Actions->call()
#14 C:\PHP Files\lib\Middleware\WebAuthentication.php(132): Xibo\Middleware\Theme->call()
#15 C:\PHP Files\lib\Middleware\CsrfGuard.php(62): Xibo\Middleware\WebAuthentication->call()
#16 C:\PHP Files\lib\Middleware\State.php(117): Xibo\Middleware\CsrfGuard->call()
#17 C:\PHP Files\lib\Middleware\Storage.php(47): Xibo\Middleware\State->call()
#18 C:\PHP Files\lib\Middleware\Xmr.php(36): Xibo\Middleware\Storage->call()
#19 C:\PHP Files\vendor\slim\slim\Slim\Slim.php(1302): Xibo\Middleware\Xmr->call()
#20 C:\PHP Files\web\index.php(124): Slim\Slim->run()
#21 {main}

SQLSTATE[21000]: Cardinality violation: 1242 Subquery returns more than 1 row Exception Type: PDOException

So I just followed the instructions @dan gave in another thread and it got rid of the unexpected error. I was able to delete and it brought back the old versions I had used the replace feature and checked delete old version to replace that particular media file. (maybe the delete old version is not working right? I am on 1.8.2?!)

I am going to keep checking and seeing if the “SQLSTATE[21000]: Cardinality violation: 1242 Subquery returns more than 1 row” error.


This text will be hidden


Xibo CMS 1.8.3

When I delete the media, I get this error and media is not deleted from the library.:

2018-01-05 15:35 WEB DELETE ERROR /library/926

SQLSTATE[21000]: Cardinality violation: 1242 Subquery returns more than 1 row Exception Type: PDOException

UPDATE media SET editedmediaid = null WHERE mediaid = 926
Then it works!

Best regards


Thanks @hhan - I have done that. I am curious if this is something I will have to continue to do or if its just a one time thing.