Bad key usually means an incorrect number has been specified after the *KEY command - but there is a limited amount of memory available for function key definitions. If the space is used up then any attempt to define more keys will also generate this error.