Bootloader issue: Can only program optiboot based board once. (solved)

Problem: Uploading sketch corrupts bootloader.
Solution: Use proper fuse setting for bootloader size on chip and in boards.txt

Boot loader only working once is probably indication that your auto reset circuit is not working. Check that out. If you can tap the reset button at upload time and observe manual reset allows upload, that would confirm. DTR of your USB to serial chip should be connected to reset on the MCU through a 0.1uF cap, and reset should have a pullup resistor to VCC. Check typical Arduino schematics to see how it works, such as Pro Mini or Uno.

cirthix:
delete
i am a moron

thanks

It is best in a forum to leave your original post, and then write back with additional details saying what finally fixed the problem. That way others who may have done the same thing will benefit when they read the thread when it become old.

dmjlambert:
It is best in a forum to leave your original post, and then write back with additional details saying what finally fixed the problem. That way others who may have done the same thing will benefit when they read the thread when it become old.

You're right. Edited OP with problem+solution.