From 1b2c8f3b22f8d5cfa4a954ee9dfa6811594f7836 Mon Sep 17 00:00:00 2001 From: Rahul Bansal Date: Mon, 2 Mar 2026 01:16:07 +0530 Subject: [PATCH] fix: populate CopyMask in contacts other delete to fix 400 error The deleteOtherContact function called CopyOtherContactToMyContactsGroup with an empty CopyOtherContactToMyContactsGroupRequest{}, but the Google People API requires the CopyMask field to specify which fields to copy. Omitting it causes a 400 badRequest error: 'copyMask is required'. Fix by setting CopyMask to include all relevant contact fields. Fixes #383 --- internal/cmd/contacts_directory.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/internal/cmd/contacts_directory.go b/internal/cmd/contacts_directory.go index 493185a4..7ad705c4 100644 --- a/internal/cmd/contacts_directory.go +++ b/internal/cmd/contacts_directory.go @@ -449,7 +449,11 @@ func deleteOtherContact(ctx context.Context, account, resourceName string) error } copied, err := otherSvc.OtherContacts.CopyOtherContactToMyContactsGroup( resourceName, - &people.CopyOtherContactToMyContactsGroupRequest{}, + &people.CopyOtherContactToMyContactsGroupRequest{ + // CopyMask is required by the People API; omitting it causes a 400 "copyMask is required" error. + // See: https://developers.google.com/people/api/rest/v1/otherContacts/copyOtherContactToMyContactsGroup + CopyMask: "names,phoneNumbers,emailAddresses,organizations,biographies,urls,addresses,birthdays,events,relations,userDefined", + }, ).Do() if err != nil { return fmt.Errorf("copy to my contacts: %w", err)