In 2009, iso7816_*() functions in scd/iso7816.c got a new argument called extended_mode to support handling extended APDUs. However, this argument is often hardcoded to zero. When the card responds with a long APDU, transaction fails with following error:
scdaemon DBG: ccid-driver: provided buffer too short for received data (263/258) scdaemon ccid_transceive failed: (0x10002) scdaemon apdu_send_simple(0) failed: invalid value
This happens for example during key generation. Function does_key_exist() from scd/app-openpgp.c calls iso7816_get_data() with extended_mode = 0 (second argument):
if (iso7816_get_data (app->slot, 0, 0x006E, &buffer, &buflen))
This works only if the response happens to be short enough. But if the DO under tag 0x6E can't fit into a short APDU, key generation fails because of short rx buffer.