Custom plugin "is in use but not enabled"

I have an issue with a custom plugin and have been tackling the issue for a while now.
After I installed and configured the plugin I’m getting repeatedly generated lines
“handler.lua:1052: could not rebuild plugins iterator via timer: api-version plugin is in use but not enabled, context: ngx.timer” in the error.log file.

I followed all steps in the current documentation. The plugin appears to be picked up when kong starts up and I’m able to add the plugin using the POST /plugins API.

More details - I did update the plugin name (api-version) to the plugins config in kong.conf to
plugins=bundled,api-version
as well as added the path to plugin (which is /usr/local/custom/kong/plugins/api-version) to the lua_package_path config param:
lua_package_path = /usr/local/custom/?.lua;/usr/local/?.lua;./?.lua;./?/init.lua;

I would appreciate any help. Thanks so much.

Just confirming for posterity that, after adding your plugin’s name to kong.conf, you ran a full ‘kong restart’ and are seeing the exact same log lines after having performed the restart.

Thanks for response! I indeed was restarting kong every time I changed configuration. I did see the plugin in the list of available plugins as well as saw a debug message in init_worker when kong was starting up. Also I’m positive that I had only one node running (which kind of eliminates the use case described in the troubleshooting section of the kong documentation). I ended up with purging kong and postgres and installing the same version (2.3.3) from scratch. I don’t observe this error anymore.

You see this error if the Plugin is enabled i.e. there is an entry in the underlying DB which says this plugin is applied somewhere (Route, Service or Global) but it is not mentioned in the KONG_PLUGINS env variable (or the plugins setting in kong.conf)
If you want to your running Kong instance to have a clean config, then purge the DB before starting Kong. This can be done via deleting everything in the “kong” database using SQL or by running kong migrations reset once you have installed kong and have configured the DB settings.
TL;DR steps-

  1. Install Kong
  2. Purge DB, kong migrations reset
  3. Bootstrap DB, kong migrations bootstrap
  4. Start Kong, kong start
  5. Init Proxy config, deck sync

Thanks so much for the details!