# Bug COSTS-193 - ActiveRecord::RecordInvalid in  Reporting::CostReportsController#update

Project: Stream Time & Costs
Status: closed
URL: https://community.openproject.org/work_packages/COSTS-193

## Open points

_No work packages_

## Details

| Attribute | Value |
| --- | --- |
| Date |  |
| Priority | Medium |
| Module | Modules and project features / Costs and budgets |
| Target versions | 18.0.0 |
| Observed in versions | 18.0.0 |
| Bug found in version (deprecated) |  |
| Requires doc change | No |
| Accessibility | No |
| Pull preview |  |
| List |  |
| Labels |  |

## People

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

## Planning

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

## Costs

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

## Description

### Steps to reproduce

1.  Got to an existing cost repord page `/reporting/cost_reports/<id>`
    
2.  Add a custom field to the &quot;Group by&quot; section of the report, either as a column or a row.
    
3.  Save the report.
    

### What is the buggy behavior?

*   Saving the report is not possible, due to an error. (see below)
    

### What is the expected behavior?

1.  Saving should be possible without errors.
    
2.  The same issue stands for creating a new cost report too.
    

### Error report

*   [https://appsignal.com/openproject-gmbh/sites/673c529383eb67b55471dda2/exceptions/incidents/2203/traces/last](https://appsignal.com/openproject-gmbh/sites/673c529383eb67b55471dda2/exceptions/incidents/2203/traces/last)
    
*   https://appsignal.com/openproject-gmbh/sites/673c529383eb67b55471dda2/exceptions/incidents/2204
    

```text
Validation failed: Query group bys Custom field415 does not exist.

modules/reporting/app/controllers/reporting/cost_reports_controller.rb:85 Reporting::CostReportsController#update
```

```text
{
  "action": "update",
  "authenticity_token": "[FILTERED]",
  "columns": "work_package_id,custom_field415,activity_id",
  "controller": "reporting/cost_reports",
  "filters": "spent_on <>d [\"2026-10-01\",\"2026-10-31\"] & user_id = \"me\"",
  "id": "411",
  "query_name": "Hours Oct 2026-1",
  "rows": "spent_on",
  "save_query": "1",
  "unit": "-1"
}
```

###   

###
