discourse/discourse · error · PresenceChannel::InvalidConfig
Expected PresenceChannel::Config or nil. Got a #{result.clas
Error message
Expected PresenceChannel::Config or nil. Got a #{result.class.name} What it means
Error "Expected PresenceChannel::Config or nil. Got a #{result.class.name}" thrown in discourse/discourse.
Source
Thrown at lib/presence_channel.rb:323
elsif cached_config
Config.from_json(cached_config)
else
prefix = name[%r{/([a-zA-Z0-9_-]+)/.*}, 1]
raise PresenceChannel::NotFound if prefix.nil?
config_block = @@configuration_blocks[prefix]
config_block ||=
DiscoursePluginRegistry.presence_channel_prefixes.find { |t| t[0] == prefix }&.[](1)
raise PresenceChannel::NotFound if config_block.nil?
result = config_block.call(name)
to_cache =
if result.is_a? Config
result.to_json
elsif result.nil?
Config::NOT_FOUND
else
raise InvalidConfig.new "Expected PresenceChannel::Config or nil. Got a #{result.class.name}"
end
DiscourseRedis.ignore_readonly do
PresenceChannel.redis.set(redis_key_config, to_cache, ex: CONFIG_CACHE_SECONDS)
end
raise PresenceChannel::NotFound if result.nil?
result
end
end
def publish_message(entering_user_ids: nil, leaving_user_ids: nil)
message = {}
if config.count_only
message["count_delta"] = entering_user_ids&.count || 0
message["count_delta"] -= leaving_user_ids&.count || 0
return if message["count_delta"] == 0
elseView on GitHub (pinned to 1b2d7253e8)
When it happens
Trigger: Thrown at lib/presence_channel.rb:323 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of discourse/discourse@1b2d7253e8 (2026-08-26).
Data as JSON: /api/errors/e3fef4a4919aa44a.
Report an issue: GitHub.