ytti/oxidized · error · KeyError
hook.nick is required
Error message
hook.nick is required
What it means
The xmppdiff hook validates at startup that jid, password, channel and nick are all present; a missing nick raises KeyError 'hook.nick is required' (lib/oxidized/hook/xmppdiff.rb:47). The nick is the nickname used inside the MUC room; connect joins as cfg.channel + '/' + cfg.nick, so the room occupant shows up as <room>/<nick> and diffs are posted under that nick.
Source
Thrown at lib/oxidized/hook/xmppdiff.rb:47
rescue Timeout::Error
logger.info "timed out"
@client = nil
@muc = nil
end
@client.on_exception do
logger.info "XMPP connection aborted, reconnecting"
@client = nil
@muc = nil
connect
end
end
def validate_cfg!
raise KeyError, 'hook.jid is required' unless cfg.has_key?('jid')
raise KeyError, 'hook.password is required' unless cfg.has_key?('password')
raise KeyError, 'hook.channel is required' unless cfg.has_key?('channel')
raise KeyError, 'hook.nick is required' unless cfg.has_key?('nick')
end
def run_hook(ctx)
return unless ctx.node
return unless ctx.event.to_s == "post_store"
begin
Timeout.timeout(15) do
gitoutput = ctx.node.output.new
diff = gitoutput.get_diff ctx.node, ctx.node.group, ctx.commitref, nil
interesting = diff[:patch].lines.to_a[4..-1].any? do |line|
["+", "-"].include?(line[0]) && (not ["#", "!"].include?(line[1]))
end
if interesting
connect if @muc.nil?
View on GitHub (pinned to 687ed4262d)
Solutions
- Add nick: oxidized under the xmppdiff hook block
- Keep all four keys jid, password, channel, nick at the same indentation level
- Restart oxidized and confirm the MUC join succeeds in the log
Example fix
# before
hooks:
xmpp:
type: xmppdiff
jid: oxidized@xmpp.example.com
password: secret
channel: netdev@conference.example.com
# after
hooks:
xmpp:
type: xmppdiff
jid: oxidized@xmpp.example.com
password: secret
channel: netdev@conference.example.com
nick: oxidized Defensive patterns
Strategy: validation
Validate before calling
# check the xmppdiff block before oxidized loads it
hook_cfg = YAML.load_file('/etc/oxidized/config')['hooks']['xmpp']
missing = %w[jid password channel nick].reject { |k| hook_cfg.key?(k) }
raise ArgumentError, "xmppdiff config missing: #{missing.join(', ')}" unless missing.empty? Type guard
def xmppdiff_cfg_valid?(cfg)
cfg.is_a?(Hash) && %w[jid password channel nick].all? { |k| cfg[k].is_a?(String) && !cfg[k].empty? }
end Try / catch
begin
hook.validate_cfg!
rescue KeyError => e
abort "fix the hooks config: #{e.message}"
end Prevention
- Pick a nick that identifies the bot so humans can filter it in the room
- Key-check all four xmppdiff keys in the config pipeline
- Avoid nicks with spaces or JID-forbidden characters
When it happens
Trigger: A hooks block with type: xmppdiff that omits nick: (jid/password/channel set), or a nick key lost to a typo, rename, or indentation error.
Common situations: Copying a partial example; assuming the resource part of the JID is enough; editing the hooks block and breaking indentation.
Related errors
- hook.channel is required
- hook.jid is required
- hook.password is required
- hook.remote_repo is required
- hook.token is required
AI-assisted analysis of ytti/oxidized@687ed4262d (2026-08-23).
Data as JSON: /api/errors/05b60edaac2d7a1b.
Report an issue: GitHub.