I don't know whether this is necessary or not for E_AMBIGUOUS. For example, you don't do it for E_NOTFOUND. I might omit this giterr_set call.