When the API method “statuses/update” returns the error code 187 (“Status is a duplicate”) the error only contains a code and a message. It should also contain the ID of the existing tweet.
My workaround is to request the last X tweets via “statuses/user_timeline” and compare their text. But this is fragile if the text contains shortened URLs.