That’ll Learn ya!

According to reports, a 17-year-old California boy got stuck in a vending machine while trying to steal some tasty goods.

Luckily a passerby saw the teen struggling and quickly called the police.

The machine, which was located outside the 24th Street trolley station in National City held the boy captive while emergency responders tried to free him.

The boy, who was not named, is apparently a student at Sweetwater High School in National City.

The rescue took about an hour — the whole time the boy sat red faced sitting next to his skateboard, according to ABC News San Diego TV affiliate KGTV.

Firefighters initially tried to open the vending machine with axes, crowbars and an air chisel.

Eventually it took a rotary saw to finally cut the thief free

“Initially, we thought if we could get a hold of somebody to come out that had a key that we would be able to open up the door and access the machine and do very little damage, but nobody had the key,” Michael LaFreniere of the National City Fire Department told KGTV.

Once free, the boy suffered only minor scrapes.

he was taken into police custody on charges of petty theft.

Boy Stuck in Vending Machine Leanrs Valuable Lesson

Boy Stuck in Vending Machine Leanrs Valuable Lesson