Aircraft: B747
Phase of flight: Taxi
Anomaly: Deviation / Discrepancy - Procedural Published Material / Policy; Ground Event / Encounter Other / Unknown

Waited outside of gate area for several minutes for self park system to light up. It turned on with green light; and as we were pulling into the gate; lights went completely dark for a second or two. As Captain applied the brakes to stop; system came back on with yellow light for several seconds; then turned completely off. By this time we were completely stopped. I looked out the side window and saw a ground personnel with the light controller in his hand; partially disassembled; and he was working on it with a screwdriver. He saw me looking at him; and then turned around and pushed the emergency stop button on the wall behind him. Self park light system then went from completely off to red. We came to find out we were 2-3 feet past the stop line. Ground crew hooked up tug and pushed the aircraft back to the line. Upon arrival at terminal at KSFO; we found the self park system to be off as we approached the gate. Several ground personnel were milling around the area; which appeared to be clear of all obstacles. There appeared to be some confusion about bringing us into the gate. After several minutes; the self park system illuminated normally and we proceeded forward to the parking spot. As we moved forward approximately 30 feet; the lights of the self park system suddenly went dark again; so I stopped. There was no effort from the ground personnel to guide us in; stop us or give us any guidance whatsoever. Again; the system illuminated; so I proceeded forward. Once again as soon as forward movement was established; the lights went out and again; I stopped. This time as the system once again illuminated and we were in close proximity to the gate; we could clearly see that the guideman who was supposed to be operating the controller to the lights was performing maintenance to the back of the controller. It appeared that the back of the controller box was off and he had a screwdriver in his other hand. He was far off to our left of the airplane and near the terminal support of the jetway. Again the lights came on; this time with a yellow caution light from the system; so I again proceeded slowly forward. Almost immediately; the lights went completely off and again I stopped. This time; I set the brakes and shut the airplane down as I could clearly see we were getting very close to the terminal and jetway. The lights came on once again; flashed red; and went dark.The agent who was in the forward jetway; appeared to be confused regarding our position and motion to us with her hands that we were about two feet off of the parking spot. Two feet forward; or two feet too far back we had no idea. There was no indication from anyone on the ground as to our position. No hand signals were given and no wands were displayed. Finally; someone came on the headset from below and informed us that we were too close and that they would push us back. B747 flight crew reported parking at a gate with a self park system that was providing erratic guidance while they were parking; resulting in an overshoot of the intended stop point.