The firearm was discharged while being examined by two forensic officers at Gayfield Square police office in Edinburgh in April. No-one was hurt in the incident but an investigation has found it was "preventable and negligent".
The Police Investigations & Review Commissioner (PIRC) said that in future advice should be sought from the Explosives Ordnance Department when dealing with an unfamiliar firearm.
The home-made weapon, described as "non-conventional", was seized during an operation by officers.
It was discharged unintentionally while being examined by a team from the Scottish Police Authority (SPA) at about 10.50am on April 14.
The incident was referred to the PIRC, which said in its investigation officers did not comply with standard operating procedures.