1. Check whether there are any typo in the code.
2. If the issues is in Apex manage sharing reason access, check the OWD of the object.
Note:
OWD of the object should be either Private or Public Read Only to access Apex Manage Sharing Reason.
Hope this helps!!