# Bug SPAR-244 - ActiveRecord::RecordNotFound in WorkPackages::DatePickerController#show

Project: Stream Planning and Reporting
Status: closed
URL: https://community.openproject.org/work_packages/SPAR-244

## Open points

_No work packages_

## Details

| Attribute | Value |
| --- | --- |
| Date |  |
| Priority | Medium |
| Module | Frontend components and Primer design system / Date picker |
| Target versions | 16.4.0 |
| Observed in versions | 15.5.0 |
| Bug found in version (deprecated) | 15.5.x |
| Requires doc change | No |
| Accessibility | No |
| Pull preview |  |
| List |  |
| Labels |  |

## People

| Attribute | Value |
| --- | --- |
| Assignee |  |
| Accountable |  |
| Product manager |  |
| Developers | Oliver Günther |
| Designer |  |
| Ordered by |  |
| Signed off by |  |
| Interest by |  |

## Planning

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

## Costs

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

## Description

### Steps to reproduce

1.  create a work package and open it in two different browser windows
    
2.  in the first window delete the work package
    
3.  in the second window try modifying the dates
    

### What is the buggy behavior?

*   when clicking the dates to open the date picker, a 500 error occurs
    
*   The 500 error is shown on a new page
    

Error message in AppSignal

```text
Couldn't find WorkPackage with 'id'=4148 [WHERE "work_packages"."id" IN (SELECT "work_packages"."id" FROM "work_packages" INNER JOIN "projects" ON "projects"."id" = "work_packages"."project_id" INNER JOIN "enabled_modules" ON "projects"."id" = "enabled_modules"."project_id" AND "enabled_modules"."name" IN ('work_package_tracking') AND "projects"."active" = TRUE WHERE "projects"."active" = TRUE)]
```

### What is the expected behavior?

1.  like when clicking other fields after the work package has been deleted, it should display a gentle message indicating that the work package cannot be found or has been deleted without further ado.
    

Note: it happens also when restricting visibility of the work package or the project by modifying permissions or stopping a share.

### Screenshots

actual:

<img class="op-uc-image op-uc-image_inline" src="/api/v3/attachments/414524/content">

expected:

<img class="op-uc-image op-uc-image_inline" src="/api/v3/attachments/414532/content">

### **Logs**

[https://appsignal.com/openproject-gmbh/sites/678fa146338a5d816f8d696c/exceptions/incidents/716](https://appsignal.com/openproject-gmbh/sites/678fa146338a5d816f8d696c/exceptions/incidents/716)

Stacktrace

```text
app/controllers/work_packages/date_picker_controller.rb:191 WorkPackages::DatePickerController#find_work_package
```
