One of the most common errors I've seen when authenticating with service accounts is that user's try to use the client JSON rather than the service account key JSON.
If I replicate this behaviour with credentials_service_account() I get an error that the file is not present, rather than it is present but the wrong file.
path <- "../../auth/client.json"
credentials_service_account(scopes = "email", path = path)
Error in read_input(file) :
file must be connection, raw vector or file path
> file.exists(path)
# TRUE
To help with this I check for the presence for $private_key in the JSON file, to help give a hint:
secrets <- fromJSON(json_file)
if(is.null(secrets$private_key)){
stop("$private_key not found in JSON - have you downloaded the correct JSON file?
(Service Account Keys, not service account client)")
}