I have enabled
Tags on a Custom Object and I am trying to insert a Tag by a following code
insert new CustomObject__tag(Type='Public',ItemId='a0023000000DtDuEAK',name='Custom Tag' );
When I execute the code I receive an error
System.DmlException: Insert failed. First exception on row 0; first error: INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY, insufficient access rights on cross-reference id: "
Usually this happens when a user doesn't have a Read permission to the corresponding record, but I am the owner of the record and have full access permission to custom object record.
How can I avoid this error?