XF 2.1 Table 'xf_error_log' doesn't exist in src/XF/Db/AbstractStatement.php

djbaxter

in memoriam 1947-2022
Code:
Table '{DATABASE_NAME}.xf_error_log' doesn't exist in src/XF/Db/AbstractStatement.php at line 228

   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 39
    XF\Db\Mysqli\Statement->prepare() in src/XF/Db/Mysqli/Statement.php at line 54
    XF\Db\Mysqli\Statement->execute() in src/XF/Db/AbstractAdapter.php at line 94
    XF\Db\AbstractAdapter->query() in src/XF/Db/AbstractAdapter.php at line 150
    XF\Db\AbstractAdapter->fetchOne() in src/XF/Mvc/Entity/Finder.php at line 1249
    XF\Mvc\Entity\Finder->total() in src/XF/Admin/Controller/Index.php at line 103
    XF\Admin\Controller\Index->actionIndex() in src/XF/Mvc/Dispatcher.php at line 350
    XF\Mvc\Dispatcher->dispatchClass() in src/XF/Mvc/Dispatcher.php at line 257
    XF\Mvc\Dispatcher->dispatchFromMatch() in src/XF/Mvc/Dispatcher.php at line 113
    XF\Mvc\Dispatcher->dispatchLoop() in src/XF/Mvc/Dispatcher.php at line 55
    XF\Mvc\Dispatcher->run() in src/XF/App.php at line 2184
    XF\App->run() in src/XF.php at line 391
    XF::runApp() in admin.php at line 13

Why is this occurring?

How do I fix it? I can't even clear the error at the moment.
 
Last edited:
MySQL version 10.3.23 (10.3.23-MariaDB)

I see suggestions in a few other threads to recreate the table using this SQL query:

Code:
CREATE TABLE xf_error_log (
        error_id INT UNSIGNED NOT NULL AUTO_INCREMENT,
        exception_date INT UNSIGNED NOT NULL,
        user_id INT UNSIGNED DEFAULT NULL,
        ip_address VARBINARY(16) NOT NULL DEFAULT '',
        exception_type VARCHAR(75) NOT NULL,
        message TEXT NOT NULL,
        filename VARCHAR(255) NOT NULL,
        line INT UNSIGNED NOT NULL,
        trace_string MEDIUMTEXT NOT NULL,
        request_state MEDIUMBLOB NOT NULL,
        PRIMARY KEY (error_id),
        KEY exception_date (exception_date)
    ) ENGINE = InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci

but when I run that I get this error:

Code:
MySQL said: Documentation
#1813 - Tablespace for table `xf_error_log`' exists. Please DISCARD the tablespace before IMPORT

I can't find the correct syntax to use for DISCARD TABLE SPACE
 
Last edited:
This is what I have tried:

Code:
DROP TABLESPACE `xf_error_log`;

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 1

Code:
DISCARD TABLESPACE xf_error_log

Error

Static analysis:

1 errors were found during analysis.

    Unrecognized statement type. (near "DISCARD" at position 0)

SQL query:

DISCARD TABLESPACE xf_error_log

MySQL said: Documentation
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DISCARD TABLESPACE xf_error_log' at line 1

Code:
ALTER TABLE xf_error_log DROP TABLESPACE

 MySQL said: Documentation
#1146 - Table 'xf_error_log' doesn't exist
 
So I'm officially baffled.
  1. Error: table doesn't exist.
  2. I try to create the table.
  3. Error: Tablespace for table exists. Please DISCARD the tablespace before IMPORT
  4. I try to discard the tablespace.
  5. Error: table doesn't exist
 
It sounds like the database is corrupted.

You may need to restore from a backup.

You should also contact your sysadmin or host to try and determine what happened on the server to cause the corruption.
 
Back
Top Bottom