Error 500 when saving company settings

Everything else works fine and I can create tasks, invoices, users etc…
But I cannot save changes after editing any company settings, I get a popup which reads:

“Error
500: Server Error”

With 2 buttons “COPY” and “DISMISS”

It is a fresh V5 install (not migrated from 4), I tend to do all the version updates as soon as they come out.
2 versions ago (about 3-4 weeks ago) this problem started.

I’ve tried some things already:

  • re-asigning permissions
  • php artisan optimize
  • php artisan config:cache
  • php artisan config:clear
  • php artisan clear-compiled
  • php artisan optimiz
  • chmod -R 775 /var/www/invoiceninja
  • chown -R www-data:www-data /var/www/invoiceninja
  • I’ve added a new line: “DB_STRICT=false” to the .env file
    All these seem to complete properly, but nothing changes…

This other commands returns an error tho:

php /var/www/invoiceninja/artisan migrate

APPLICATION IN PRODUCTION.
Do you really wish to run this command? (yes/no) [no]
❯ yes

INFO Running migrations.

2023_04_27_045639_add_kmher_language … 12ms FAIL

In Connection.php line 760:

SQLSTATE[42000]: Syntax error or access violation: 1091 Can’t DROP COLUMN enable_e_invoice; check that it exists (SQL: alter table companies drop e nable_e_invoice)

In Connection.php line 545:

SQLSTATE[42000]: Syntax error or access violation: 1091 Can’t DROP COLUMN enable_e_invoice; check that it exists

For some reason, it seems that:
2023_04_27_045639_add_kmher_language … 12ms FAIL

and then I also get:
SQLSTATE[42000]: Syntax error or access violation: 1091 Can’t DROP COLUMN enable_e_invoice; check that it exists

I’ve tried to
php artisan migrate:refresh
php artisan migrate
php artisan migrate:fresh

And it was able to reinstall everything just fine, but I ended with an empty database, so I had to roll back…

Any help or pointers greatly appreciated.

Hi,

To solve this I think you’ll need need to comment out the lines in the database migration which are failing to run. How did you setup the app, have you checked the code out off GitHub or another method?

@david we’re seeing a few users report the same error, is it possible the migrations are being changed after they’ve been committed?

I’ve only seen this particular issue when there has been a DB rollback at some point.

If the DB is rolled back I’d expect both the fields to be removed and the migrations table to be updated, in general I’d think users should be able to roll-back and then roll-forward?

Thank you @hillel and @david
I misspoke when I said roll back, I didn’t know it had a specific meaning when working with artisan.
What I really meant is that I had to reload the instance at an earlier point in time from a snapshot.

So if there is a process to roll back without ending with an empty database, please explain how to do this.