# Bug OP-19964 - MeetingOutcome invalid kind value crashes with 500 instead of 422

Project: OpenProject
Status: closed
URL: https://community.openproject.org/work_packages/OP-19964

## Open points

_No work packages_

## Details

| Attribute | Value |
| --- | --- |
| Date |  |
| Priority | Medium |
| Module | API, Modules and project features / Meetings |
| Target versions | 17.9.0 |
| Observed in versions |  |
| Sprint |  |
| Backlog bucket |  |
| Bug found in version (deprecated) |  |
| Found in mobile app version |  |
| Follow-up feedback e-mail |  |
| Requires doc change | No |
| Accessibility | No |
| Pull preview |  |
| List |  |
| Labels |  |

## People

| Attribute | Value |
| --- | --- |
| Assignee |  |
| Accountable |  |
| Product manager |  |
| Developers |  |
| Designer |  |
| Ordered by |  |
| Signed off by |  |
| Interest by |  |

## Planning

| Attribute | Value |
| --- | --- |
| Relevance |  |

## Costs

| Attribute | Value |
| --- | --- |
| Votes |  |
| Work |  |
| Labor costs |  |

## Description

### Before filing a report

Confirmed reproducible on the latest available patch release of the 17.7 minor line (17.7.1, the latest at the time of testing) via direct REST API calls against a real instance. Searched community.openproject.org for existing reports (by "MeetingOutcome", "meeting outcome kind", "enum kind", "outcome invalid") — found no existing report covering this. A minimal, verified fix is proposed below, also submitted as a pull request: https://github.com/opf/openproject/pull/24771

### Steps to reproduce

1. Login as an admin, or as a user with `view_meetings` and `manage_outcomes` (plus the permissions needed to create/manage the meeting and agenda item) in a project.
2. Create a meeting and move it to `in_progress` state (`PATCH /api/v3/meetings/{id}` with `{"state":"in_progress","lockVersion":<current>}`).
3. Create a meeting agenda item on that meeting (`POST /api/v3/meeting_agenda_items` with a `_links.meeting` pointing at the meeting above).
4. Send a `POST /api/v3/meeting_outcomes` request with a `kind` value that is NOT one of the three valid enum values (`information`, `decision`, `work_package`), e.g. `"kind": "bogus_value"`, and `_links.agendaItem` pointing at the agenda item created above.

### What is the buggy behavior?

The request returns **HTTP 500** instead of a clean validation error:
```json
{"_type":"Error","errorIdentifier":"urn:openproject-org:api:v3:errors:InternalServerError","message":"An internal error has occurred. 'bogus_value' is not a valid kind"}
```

Root cause: `modules/meeting/app/models/meeting_outcome.rb` declares its `kind` enum without Rails' `validate: true` option:
```ruby
enum :kind, {
  information: 0,
  decision: 1,
  work_package: 2
}.freeze, suffix: true, default: "information"
```
Without `validate: true`, Rails' bare enum setter raises a raw `ArgumentError` when assigned an unrecognized string, rather than producing an `ActiveModel` validation error. That `ArgumentError` propagates uncaught through the Grape endpoint and surfaces to the API caller as an opaque 500.

### What is the expected behavior?

The request should return **HTTP 422** with a clear, standard validation error message (e.g. "Kind is not set to one of the allowed values."), the same way any other invalid-enum-value write is rejected elsewhere in the API.

### Logs

```
HTTP/1.1 500 Internal Server Error
content-type: application/hal+json; charset=utf-8
{"_type":"Error","errorIdentifier":"urn:openproject-org:api:v3:errors:InternalServerError","message":"An internal error has occurred. 'bogus_value' is not a valid kind"}
```

### Screenshots and other files

None — this is a pure backend/API bug with no UI reproduction path tested; the REST API reproduction above is sufficient to demonstrate it independent of any client.

### Environment information

**OpenProject installation type**

* Docker All-in-one container (official `openproject/openproject` image: `17.7.1`)

**OpenProject version**

Reproduced on `17.7.1` (the latest release in the 17.7 line at the time of testing). Confirmed present unchanged in source on the `dev` branch (checked against the full source checkout).

**Browser**

Not applicable — reproduced via direct REST API calls, no browser involved.

**Operating System**

Not applicable — server-side bug, reproduced against a Linux-based Docker container; the client OS is irrelevant to the reproduction.

**Language**

Not applicable — no UI/browser interaction involved in the reproduction.
