julien-nc / cospend-nc

๐Ÿ’ฐ ๐Ÿ’ฒhared budget manager Nextcloud app
GNU Affero General Public License v3.0
225 stars 29 forks source link

adding new category gives Internal Server Error #301

Open maurerle opened 1 week ago

maurerle commented 1 week ago

I see that a POST request to /ocs/v2.php/apps/cospend/api/v1/projects/my-project/category is made.

with this payload: {"name":"Rent","icon":"๐Ÿ›–","color":"#000000","order":0}

I am using Cospend 1.6.1 and Nextcloud 28.0.9 with Chromium 128.0.6613.113

In the nextcloud docker container log I only see nextcloud | 172.20.0.1 - 06/Sep/2024:07:10:04 +0000 "POST /ocs/v2.php" 500

I found the following in /settings/admin/logging (with no app in context
instead of cospend):

DbalException
An exception occurred while executing a query: SQLSTATE[23505]: Unique violation: 7 ERROR: duplicate key value violates unique constraint "cospend_categories_pkey" DETAIL: Key (id)=(6) already exists.
Exception thrown: OC\DB\Exceptions\DbalException

This is even the case I f the category name is completely new..

julien-nc commented 1 week ago

This is similar to https://github.com/julien-nc/cospend-nc/issues/299.

Have you ever made manual operations to your database?

It seems like Postgre gets confused with its own autoincrement IDs. I don't think that's a Cospend issue. Let's figure that out.