# Bug OP-17713 - API: Server error when passing invalid links

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

## Open points

_No work packages_

## Details

| Attribute | Value |
| --- | --- |
| Date |  |
| Priority | Medium |
| Module | API |
| Target versions | 16.4.0 |
| Observed in versions | 16.2.0 |
| Sprint | 16.4.0 |
| Backlog bucket |  |
| Bug found in version (deprecated) | 16.2.x |
| 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 | Jan Sandbrink |
| Designer |  |
| Ordered by |  |
| Signed off by |  |
| Interest by |  |

## Planning

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

## Costs

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

## Description

### Steps to reproduce

1.  Call a writing API endpoint (i.e. create or update) that accepts `_links`

2.  Instead of passing a valid link object (`{ "href": "something" }`), pass a string

Full example:

``` text
PATCH https://openproject.local/api/v3/storages/2

{
  "_links": {
    "banana": "is healthy"
  }
}
```

### What is the buggy behavior?

An error occurs and the server responds in an HTTP 500.

``` text
undefined method 'merge' for an instance of String
```

### What is the expected behavior?

Since the error is on the client side, an HTTP 4xx should be raised and it should indicate what's wrong about the request.

### Logs

  - AppSignal: <https://appsignal.com/openproject-gmbh/sites/678fa146338a5d816f8d696c/exceptions/incidents/978>
