David Gray was given a huge overdose of diamorphine
An out-of-hours GP service, which employed a locum who gave a man a fatal overdose, had seen two other patients collapse after being given overdoses.
Dr Daniel Ubani was on his first shift for out-of-hours firm Take Care Now in 2008 when he was called to treat David Gray, 70, at his Cambridgeshire home.
An inquest heard Dr Christopher Browning, of Take Care Now (TCN), had issued a warning to staff about doses.
He said he was concerned at the giving of incorrect doses.
Dr Ubani, who came from Germany, injected Mr Gray at his Manea home with 10 times the recommended dose of diamorphine in February 2008, the hearing has been told.
Warning to staff
Mr Gray had been suffering from kidney pains.
Dr Browning, clinical governance lead for TCN, said he had issued a warning to staff about the dangers of giving incorrect doses after two patients were treated in hospital in the year before the death of Mr Gray.
The warning was issued in January 2008 after the two patients from Suffolk, who were in acute pain, were mistakenly given 30mg of diamorphine.
Both collapsed and were taken to hospital for resuscitation, the inquest heard.
Dr Browning sent the letter to TCN's clinical team to request that the out-of-hours doctors must contact their duty managers before opening a palliative care box - where the large doses are kept.
He said the check must be done to ensure no more overdoses occurred.
"This is a systematic failure in our system which we must take steps to remedy," said Dr Browning in the letter.
He said if steps were not taken to amend the system it could result in a patient's death.
The inquest, being heard by Cambridgeshire North and East Coroner William Morris, was also examining the death of another of Dr Ubani's patients.
Iris Edwards, who lived in a care home in Ely, died of a heart attack the day after she was treated by Dr Ubani.
The case of David Gray prompted the Care Quality Commission to start an investigation into the care provided by TCN.
The hearing continues.