Chosen Solution

I have a 1999 Toyota Rav4 2.0L and I’ve replaced coils, plugs, timing belt, crank sensor and cam sensor, did continuity test from crank sensor and cam sensor to the computer and the wiring checks out ok, but its still throws a p0340 code for cam sensor, any ideas would be greatly appreciated

Engine vacuum leak will cause it to run rough and can throw ecm / cam sensor code

checked wires? follow the harness back, look for breaks or rubbing.