lemmy icon indicating copy to clipboard operation
lemmy copied to clipboard

[1.0] Create report fails

Open Nutomic opened this issue 1 month ago • 3 comments

Requirements

  • [x] Is this a bug report? For questions or discussions use https://lemmy.ml/c/lemmy_support or the matrix chat.
  • [x] Did you check to see if this issue already exists?
  • [x] Is this only a single bug? Do not put multiple bugs in one issue.
  • [x] Do you agree to follow the rules in our Code of Conduct?
  • [x] Is this a backend issue? Use the lemmy-ui repo for UI / frontend issues.

Summary

Creating post/comment reports often fails with this error:

[crates/api/api/src/reports/post_report/create.rs:68:16] PostReport::report(&mut context.pool(), &report_form).await = Err(
LemmyError {
message: CouldntCreate,
caller: /home/felix/workspace/lemmy/lemmy/crates/utils/src/error.rs:278:20,
inner: DatabaseError(
UniqueViolation,
"duplicate key value violates unique constraint \"post_report_post_id_creator_id_key\"",
),
},
)

[crates/api/api/src/reports/comment_report/create.rs:70:16] CommentReport::report(&mut context.pool(), &report_form).await = Err(
LemmyError {
message: CouldntCreate,
caller: /home/felix/workspace/lemmy/lemmy/crates/utils/src/error.rs:278:20,
inner: DatabaseError(
UniqueViolation,
"duplicate key value violates unique constraint \"comment_report_comment_id_creator_id_key\"",
),
},
)

As normal user report creation sometimes works, as admin it always seems to fail. Tested both locally and on voyager.

Nutomic avatar Dec 04 '25 10:12 Nutomic

Not sure why this would be. We have both unit tests and federation tests for create comment and create post reports. This has to be a lemmy-ui issue then.

dessalines avatar Dec 04 '25 18:12 dessalines

I looked in the front end code and didn't see anything obvious. The only thing I can think is that you already reported the item on your admin account, and obviously it doesn't let you report the same item twice.

dessalines avatar Dec 04 '25 19:12 dessalines

Its not that, the problem also happens when reporting a new post. Seems like something is wrong with the db constraints, or maybe somewhere its passing a wrong id. Will debug it when I have the time.

Nutomic avatar Dec 04 '25 20:12 Nutomic

I just tested this on voyager.lemmy.ml and couldn't replicate.

dessalines avatar Dec 11 '25 16:12 dessalines

I also cant reproduce it anymore, closing.

Nutomic avatar Dec 15 '25 10:12 Nutomic