Not able to generate key

I have tyk gateway on-premise set up. After I add an api using tyk/apis, I try to generate a key using tyk/keys. And I get
“status”: “error”,
“message”: “Failed to create key, ensure security settings are correct.”

Once I restart tyk-gateway The same api return me proper response with key.

What could be the issue.

Please help

This message is too general.
Do you have access to gateway logs?
Does it print any details there? (Put “log_level”: “debug” to tyk.conf to make it more verbose).

I am not able to set gateway log too

  "listen_address": "",
  "listen_port": 8080,
  "secret": "352d20ee67be67f6340b4c0605b044b7",
  "template_path": "/opt/tyk-gateway/templates",
  "use_db_app_configs": false,
  "app_path": "/opt/tyk-gateway/apps",
  "middleware_path": "/opt/tyk-gateway/middleware",
  "storage": {
"type": "redis",
"host": "localhost",
"port": 6379,
"username": "",
"password": "",
"database": 0,
"optimisation_max_idle": 2000,
"optimisation_max_active": 4000
  "log_level": "debug",
  "enable_analytics": false,
  "analytics_config": {
"type": "",
"ignored_ips": []
  "dns_cache": {
"enabled": false,
"ttl": 3600,
"check_interval": 60
  "optimisations_use_async_session_write": true,
  "allow_master_keys": false,
  "policies": {
"policy_source": "file"
  "hash_keys": true,
  "suppress_redis_signal_reload": false,
  "force_global_session_lifetime": false,
  "max_idle_connections_per_host": 500

This is my tyk.conf