Removing a user who has signed documents fails with unhelpful "internal server error"
Trying to remove a user from an organization fails with a generic "internal server error" if that user has signed any documents (or is referenced by other records like assets, tasks, etc) - message is unhelpful and does not tell the user why the error occurs.
Steps to reproduce
- Log in as an Owner
- Go to People → add a new person (e.g. Employee role)
- Have that person sign a document (or assign them as owner of a task/risk/asset)
- Go back to People → try to remove that person via the "..." menu
- Error: "Failed to remove person: An internal server error occurred."
Thanks @emimoir for the report.
We've shipped two improvements in probod v0.222.0:
-
Task assignee / risk owner — You can now remove a person who is assigned to a task or owns a risk. Those references are cleared automatically on deletion (
ON DELETE SET NULL). -
Asset owner (and other blocking references) — When removal is blocked because the person is still linked to a record that must be preserved (e.g. as an asset owner), the API now returns a
409 Conflictwith "cannot remove person: referenced by other resources" instead of a generic internal server error. See the v0.222.0 changelog.
This builds on an earlier fix in probod v0.191.0 that started mapping foreign-key violations during profile deletion to a CONFLICT response (changelog).
The same explicit conflict response also applies when the person has signed documents — removal is still blocked in that case, but you should no longer see a generic internal server error.
Still outstanding: automatically removing a person who owns an asset (today you need to reassign the asset first). We'll track that separately.
Closing this issue for the error-handling and task/risk cases. Happy to reopen if you still hit an internal server error on probod ≥ v0.222.0.