Plugin causes odd error on admin pages - cant hydrate plugin without id


I was creating a plugin and ran into the error:

Error: Can't hydrate plugin without an `id`
    at Class._hydrate (discourse/models/store:330)
    at eval (discourse/models/store:222)
    at (<anonymous>)
    at Class._resultSet (discourse/models/store:221)
    at eval (discourse/models/store:80)
    at tryCatcher (ember:61303)
    at invokeCallback (ember:61476)
    at publish (ember:61462)
    at eval (ember:55822)
    at invoke (ember:54023)

I was wondering if anyone could tell me what id this is referring to?
the error only appears in the console when I navigate to /admin and then go to the plugins page.
What other information is needed to debug this error?

What is the plugin you installed?

1 Like

It is one we are currently developing. I will post a link to it as soon as I get the okay to open source it

We figured it out. If we navigate to /admin/plugins.json we could see that the plugin id which is usually populated by the plugin name was not set.

It turns out those fields are populated by having a section of comments in the plugin.rb file… so the fix was adding this in:

# frozen_string_literal: true
# name: example
# about: example about
# version: 1.0
# authors: example 
# url: example

I feel like if you are going to require comments in a file this should be well documented somewhere… so I’ll leave this solution here.

1 Like