China’s indebted local governments are increasingly imposing controversial fines on residents in a bid to generate revenue, stoking anger among social-media users.

A Shanghai restaurateur was fined 5,000 yuan ($702) this month for serving shredded cucumber without a license, prompting outrage on China’s Twitter-like Weibo. In a post viewed 9.5 million times, one user wrote: "If they wanna fine you, even adding vinegar could be wrong.”

Truckers in central Henan province last month made headlines when they questioned the accuracy of government vehicle weighing machines, after being repeatedly fined for exceeding limits: one driver had received tickets totaling $38,000 in the past two years.