It was supposed to be a great year for marijuana entrepreneur Brian Blatz.

When California broadly legalized pot on Jan. 1, the lawyer with a background in banking and health care had been working for a year to set up a trucking company that would whisk fragrant marijuana buds, infused juices and other products from fields and production plants to store shelves.

On its website, Long Beach-based Verdant Distribution said the company’s goal was to be the United States’ pre-eminent business for transporting cannabis.

But it’s all gone. The trucks were sold to cover debt, a warehouse vacated, its license expired.

The choppy rollout of California’s legal market saddled the company with costly delays, but it was undone by an abrupt state rule change that allowed just about any marijuana business to become its own distributor, undercutting the need for stand-alone companies like Verdant.

In California’s emerging market, “the challenges are tremendous,” said Blatz, who is now advising clients in the fledgling industry. “Suddenly, the whole game changes on you.”

In a nation increasingly embracing legal cannabis, California stands out as the country’s biggest pot shop. Top-shelf marijuana, concentrates, balms and munchies are being produced and sold. Some companies are doing well, especially those with deep pockets that can handle the market’s twists and turns.

But many are not. And some, like Blatz’s company, already are casualties.

At year’s end, California’s effort to transform its longstanding illegal and medicinal marijuana markets into a unified, multibillion-dollar industry remains a work in progress. It’s a mix of success stories, struggles and crashes.

The illegal market continues to flourish — by some estimates, up to 80 percent of the sales in the state still are under the table, snatching profits from legal storefronts.

With many communities banning marijuana sales, limiting the number of licenses or simply not creating rules for the legal market to operate, the supply chain is fragile, leaving some shops with sparsely stocked shelves. A battle over home deliveries of pot in communities that have banned marijuana businesses could end up in court.

A promised state tax windfall has yet to arrive, while businesses complain about hefty tax rates that can approach 50 percent in some communities. The number of testing labs remains tight. Meanwhile, shifting rules and start-up costs are taking a toll.

In Los Angeles, where the pace of licensing has lagged, Adam Spiker, who heads an industry group, summed up the condition of most companies with one word, “Pain.”

He says tax rates need to be cut to entice buyers into the legal market, and the city needs to rapidly expand the number of licenses for shops to sell cannabis.

“The encouraging sign, the state is open for business,” said Spiker, executive director of the Southern California Coalition. But “if you have limited access to retail, that’s going to force a lot of companies to fail.”

A year into broad legal sales, “no one has it figured out in California,” he said. “It’s so new, so big, so turbulent.”

In general, California treats cannabis like alcohol, allowing people 21 and older to legally possess up to an ounce and grow six marijuana plants at home.

What’s emerged is a patchwork. Marijuana farms proliferate in Santa Barbara County and legal pot shops are never far away in San Francisco. But other places ban all commercial marijuana activity, or allow cultivation but not sales.

The state’s top pot regulator, Lori Ajax, said her goal in 2019 will be to get more licensed businesses in the marketplace, while increasing enforcement against illegal operators.

One of the fortunate ones has been Arizona-based Harvest Health & Recreation, which has operations in a dozen states and over 400 employees, including in California, and recently started trading on the Canadian stock exchange. By the end of next year, the company expects to have at least 20 retail shops in California, a manufacturing plant and a statewide distribution system.

Company president Steve Gutterman praised the state’s efforts to open the legal market — the consumer is getting quality, safe products. But he said he’d welcome a more aggressive push against illegal operators, and pot companies need access to banking — most financial institutions won’t do business with cannabis companies because it remains illegal at the federal level.

“There has been good and bad,” he said, but “California is a great place for us.”

That’s not the case for many retail businesses in Los Angeles.

Drive through California’s largest city and there are plenty of shops and billboards advertising pot sales, and some businesses provide Apple store-like settings to pick from buds with names like Blue Dream and Chocolate Gelato.

But the number of shops is part of the problem — hundreds are illegal. Here, and elsewhere, the illicit market that thrived for decades continues to do robust business, often in plain sight.

Police do periodic crackdowns on individual businesses, but it barely makes a dent in the illicit marketplace.

In a letter to Los Angeles officials in November, the United Cannabis Business Association said legal shops are struggling to keep their doors open while illegal storefronts flourish, selling products for as much as 50 percent below legal rivals.

Those illegal shops “do not pay taxes, do not pay the cost of ... city and state regulations, and do not follow required worker protections,” wrote the group, which represents legal retailers.

Larger companies can weather the transition to the legal market — some say government rules favor them — but smaller operators are taking out second and third mortgages, industry experts say.

In L.A., “we are seeing a regulated industry that is bleeding out,” said Ruben Hoing, the business group’s executive director.