Error if key can't be generated.