#1691·homebox

PUT /v1/entities/{id} silently deletes omitted custom fields, asset ID, parent, type and tags

Author: zcohen-nerdCreated Aug 18, 2026Updated Aug 18, 2026
Labels🕷️ bug

First Check

  • This is not a feature request
  • I added a very descriptive title to this issue.
  • I used the GitHub search to find a similar issue and didn't find it.
  • I searched the documentation, with the integrated search.
  • I already read the docs and didn't find an answer.
  • I can replicate the issue inside the Demo install.

Homebox Version

0.26.2

What is the issue you are experiencing?

Custom field writes via the API now work (#931), and I've been using them to automate inventory entry across ~320 assets on v0.26.2 (commit e01dd737238a3fa7e1a6454b37de6c6fc88c86e4). Reporting a hazard in how that write behaves — it very nearly cost me the dataset.

Behaviour

repo.EntityUpdate has no omitempty on any member, so PUT /v1/entities/{id} treats the request body as the complete desired state.

Omitting fields deletes every custom field on the entity. HTTP 200, no warning.

Omitting scalars blanks them:

  • assetId — cleared
  • parentId — unset, so the entity is unparented from its location
  • entityTypeId — cleared
  • tagIds — stripped

Why this is easy to hit

Read and write field names differ:

Read as Write as
parent parentId
entityType entityTypeId
tags tagIds

So the obvious careful pattern — GET the entity, change one value, PUT it back verbatim — silently drops all three, plus assetId. Every response is 200.

Reproduction

  1. Create an entity with a custom field, a parent location, an entity type and a tag
  2. GET /v1/entities/{id} and note the response body
  3. PUT that body back unmodified
  4. GET again — custom fields gone, asset ID blank, entity unparented, tags removed

Also reproduces with a minimal PUT setting only name.

Impact

An ordinary "update the purchase price" or "rename this asset" call destroys data the caller never referenced. A bulk update loop across an inventory corrupts every row while returning 200 throughout, so there is no signal to stop on.

In my case the custom field being silently deleted was the one my integration filters on, so the damage would have surfaced later as an empty query result rather than as an error.

Workaround, for anyone else automating

Read first, echo every untouched field back with its id, and always send an explicit fields array. Echo all four scalars above using their write-side names.

PATCH is safe for non-field edits — EntityPatch has no Fields member and leaves custom fields intact.

The CSV import path also writes custom fields via HB.field.{Name} columns with no pre-definition needed, which works as a bulk fallback.

Suggested fix

Either omitempty on EntityUpdate members, or document PUT as full-replacement and point integrators at PATCH. Happy to submit a PR if the maintainers have a preference on direction — I have the repo cloned at v0.26.2 already.

How can the maintainer reproduce the issue?

  1. Create an item with a custom field, a parent location, an entity type and at least one tag.
  2. GET /api/v1/entities/{id} and copy the response body exactly.
  3. PUT that same body back to /api/v1/entities/{id}, unmodified.
  4. GET the entity again.

Result: the custom field is gone, asset_id is blank, the item is no longer in its location, the entity type is cleared and the tags are removed. Every request returned HTTP 200.

Also reproduces with a minimal body — PUT {"name": "renamed"} to an item that has custom fields, and the custom fields are deleted.

Cause: repo.EntityUpdate has no omitempty, so PUT is full-replacement. Read and write names differ (parent → parentId, entityType → entityTypeId, tags → tagIds), so a verbatim round-trip drops them all.

Deployment

Docker (Linux)

Database Type

SQLite

OS Architechture

x86_64 (AMD, Intel)

Deployment Details

No response