The 17-year-old boy was placed on four months' supervised probation by Judge John O'Connor at Dublin Children's Court.
The teenager had been warned he could face a six-month term for the botched raid but a positive probation report on him was furnished to the court at his sentence hearing.
The boy, who cannot be named because he is still a minor, pleaded guilty to attempted robbery in connection with the raid at the China Kitchen in Leixlip in Co. Kildare on November 3 last year.
The teenager, who was accompanied to court by a family member, entered the Chinese restaurant and threw a pouch at a female staff member before telling her “give us the money”. He was brandishing a knife and wearing a balaclava at the time.
However, Judge O'Connor heard the teen's balaclava was of such poor quality the restaurant workers could still recognise him. The staff refused to give him any money and the court also heard the youth appeared to have been more afraid than them.
The teenager ran away and when he encountered a garda he told the officer what he had done and where he had discarded the knife and balaclava.
Defence solicitor Gareth Noble had told Judge O'Connor that the teenager had a cannabis debt and owed several hundred euro. The court heard the teen thought he was in danger and “ he was afraid he was going to be whacked”.
His mother has since paid his debt to the drug-dealers who are no longer willing to sell to him.
Prosecuting Garda Conor Morris agreed with the lawyer that it was an unsophisticated, “ham-fisted” crime. Judge O'Connor had ordered that the pre-sentence report was to address the teen's drug taking and victim impact.
He must remain under supervision of the Probation Service and follow their directions to divert him from re-offending otherwise he could be brought back to court and face the risk of a custodial sentence in a juvenile detention centre.