Atmega328p won't program on custom PCB

Unfortunately there is a bug with the avrdude 6.3.0-arduino12 included with the Arduino AVR Boards 1.6.20x beta package that causes this error when you try to use an Arduino as ISP:

The solution is to downgrade to Arduino AVR Boards 1.6.21:

  • Tools > Board > Boards Manager
  • Wait for download to finish.
  • Click on "Arduino AVR Boards".
  • From the dropdown version menu, select "1.6.21".
  • Click "Install".
  • Wait for installation to finish.
  • Click "Close".