EDIT: To summarise - when I take the microcontroller off the board, it works. But when I leave it on the board and try to program it, I cannot.
I have designed a PCB and had it fabricated. This PCB has ICSP programming pins specifically for the purpose of allowing it to be reprogrammed in-situ.
My problem is that the chip (ATtiny44A) will not accept new programming - indeed, the programmer hardware doesn't even detect its presence! - unless I remove it from the board and place it into a ZIF socket.
When I try to program the chip on the board (using a clone USBasp and avrdude), it says "target didn't answer" and such - in other words, no chip found. Very occasionally it works (like, one time in fifty), but reports verification errors and the like.
I have tested that the ICSP pins are connected to the correct pins of the chip using a multimeter; and also checked for shorts between the pins.
I have partially assembled the board. I realise that ICSP can often be negatively affected by the presence of other connected circuitry; but I have not yet placed any components that should cause a problem.
Here is the schematic. I have greyed out parts that are not yet present on the board. As you can see, nothing has been connected to the microcontroller by more than one wire, and therefore does not exist:
Here are some pictures of the board. The enamelled wire is present because I damaged a trace on the board whilst soldering. Two of the resistors underneath the chip are only connected at one end, in an attempt to diagnose the problem.
I've tried everything I can think of. What could be causing this strange behaviour?