Let's look at a few reasons robots might want to eat (or at least hunt) others:
Being a predator lets you stay active all day
Sure you could be a boring robot and harvest solar energy. But this is not a very high power density. A car takes about 1L of gasoline to run 12 km. To have enough energy for a measly 1km ride, a robot with ideally efficient solar panels of 1m2 in perfect weather conditions will need to charge for almost 3 hours. You're really spending most of your day napping, and you're not going places. Then there is the night problem. We're not very good at storing electric energy. So at night you're mostly sleeping, too.
The same problem is going to arise for pretty much all renewable sources: low energy density + not available on demand. That would result in huge (which in turns consumes more power) and not very active robots. If your planet ran out of fossil fuel, generating your own energy makes you... essentially an easy prey. Predatory behaviors then seem like an efficient strategy (although it's more likely that being parasitic will give you better results; steal some batteries but don't kill the giant autonomous power station)
If you do have fossil fuel/nuclear energy, it is a bit harder to justify unless those resources are scarce enough to explain hunting for gasoline. But being dependent on fossil resources would probably lead to sedentary behaviour (you stay near that yummy puddle of oil that you found). That could still leave room for predatory nomadic species of robots.
it's not about nutrition, it's about population control
A robot can only last that long. Electronic components will oxidize, mechanics parts will rust, break, etc... 435
So the god-engineer who designed robotic life programmed the robots to "recycle": every robot seeks to produce another robot of his own species every 5 years (you don't want to have robots only making one copy, because your population will go down every time a robot breaks before reproduction, leading to an unevitable statistical extinction).
With every robot potentially making several copies, you need to avoid overpopulation, so hunting robots are designed. They are hunting primarily the older robots close to failure. There you have your predatory chain of recylcing robots. The predators also reproduce. They are not hunted, but if they grow too numerous, they will start starving(they don't have any other mean of energy generation), thus a carefully planned equilibrium is reached (see prey-predator models)
N.B: You could have other, more ideal systems to maintain a fixed population. For example, just have the other robots build a new friend every time they detect a robot death in the world. But that would require for all robots to be connected and cooperating as a society. You could find a few reasons why this is not the case
getting resources is not hard, but crafting is a highly specialized task
Ok, maybe you have abundent fuel, but you still need to refine it. You have enough copper, silicon, etc but turning it into a processor to change yours or reproduce is another story. Those manufacturing processes are pretty complex and robots as we design them are usually good at one thing, not 1000. Very dexterous robots are unlikely to have a factory built inside them. So they need help from other robots. Sure enough you could do that in a peaceful way and build an economy around it... but if the processor-generating robots reproduce fast enough and are not very mobile, it's definitely easier to rip them open and get the goods directly.
So it's not so much a herbivor/carnivor dichotomy, it's more like you have specialized manufacturing units, and jerks who just take what they produce when they need it. The frequency of hunting in those conditions would be signifcantly lower tho (you might not need to hunt for a new processor before 10 years. Might be more regular if we're considering fuel) 1008