Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding new category gives Internal Server Error #301

Open
maurerle opened this issue Sep 6, 2024 · 2 comments
Open

adding new category gives Internal Server Error #301

maurerle opened this issue Sep 6, 2024 · 2 comments

Comments

@maurerle
Copy link

maurerle commented Sep 6, 2024

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
Copy link
Owner

This is similar to #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.

@maurerle
Copy link
Author

So I tried to add a new category a few times.
The last error today was:

 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)=(11) already exists.
Exception thrown: OC\DB\Exceptions\DbalException 

I then created another empty project and found that the new project somehow had all the categories listed.
I then tried adding another category to my existing project, which just worked.
Everything else did just work as well afterwards.

This leaves two possible reasons:

  1. creating the new project did somehow revive the ids 0-11 (as there are 12 default categories) and fix the problem
  2. i had to click a lot until the Key (id)=(6) already exists counter does go up to new empty ids. I do not know why I did not have the default categories there in the first place

Anyway this is fixed on my side.
I think I could take a look at the specific table to further analyze which ids the new groups have to see which thesis is right.
Should be the cospend_categories table.. But well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants