How to handle a node translation containing an entity reference with a managed field property I have a custom field that contains a managed file. The node that the field is attached to and the field are enabled for translation.

I create a piece of content, which defaults to the site default language EN. The content contains a managed file, let's say FID 1.

From the admin content screen I select Translate and add a translation. When the node edit form is rendered, it contains the values from the original content as it should, and contains the file information as well, so that I need to remove the original and add a new one.

When I save this version, language ES, both appear on the admin page and in the db. The property for the managed file in ES has FID 2.

The issue is when switching back to English using the language widget on the home page, a 500 is received. The reason is that removing the managed file from the Spanish translation in order to add the correct one resulted in the actual file being removed as well as the FID 1 file_managed table entry, but 1 still remaining in the property value for the managed file in the custom field.

I could probably finagle the custom field widget to not present a default value for the managed file property somehow in the case of adding the node, but that seems wrong, because it's possible that the user to leave the file the same. 

Is there a standard way to handle this?
There are a number of issues with reference counting files: see this overview. You might be affected by $entity->isDefaultTranslation() behaves incorrectly when changing default translation, causing file/image field usage to be set to zero, causing files to be deleted.

Note that due to the potential for lost data, as of 8.4 the default behaviour has been changed to not delete files even if their ref count reaches zero. See the CR for more.