ytti/oxidized · error · KeyError
hook.remote_repo is required
Error message
hook.remote_repo is required
What it means
The githubrepo hook validates at config-load time that its block contains a remote_repo key; KeyError 'hook.remote_repo is required' (lib/oxidized/hook/githubrepo.rb:5) aborts oxidized startup until the key exists. remote_repo is the git URL the hook pushes node configs to and may be a single URL string or a per-group mapping of repositories.
Source
Thrown at lib/oxidized/hook/githubrepo.rb:5
require 'rugged'
class GithubRepo < Oxidized::Hook
def validate_cfg!
raise KeyError, 'hook.remote_repo is required' unless cfg.has_key?('remote_repo')
end
def run_hook(ctx)
unless ctx.node
logger.error 'GithubRepo.run_hook: no node provided'
return
end
unless ctx.node.repo
logger.error "Oxidized output is not git, can't push to remote"
return
end
repo = Rugged::Repository.new(ctx.node.repo)
creds = credentials(ctx.node)
url = remote_repo(ctx.node)
if url.nil? || url.empty?
logger.error "No repository defined for #{ctx.node.group}/#{ctx.node.name}"View on GitHub (pinned to 687ed4262d)
Solutions
- Add the key under the hook block: remote_repo: git@github.com:corp/netconfigs.git
- For per-group repos use a map: remote_repo: { default: git@github.com:corp/default.git, edge: git@github.com:corp/edge.git }
- Verify remote_repo sits at the same indentation level as the hook's other keys
- Restart oxidized; validation runs at load time and startup should proceed past hooks
Example fix
# before
hooks:
push_to_github:
type: githubrepo
username: oxidized
password: secret
# after
hooks:
push_to_github:
type: githubrepo
remote_repo: git@github.com:corp/netconfigs.git
username: oxidized
password: secret Defensive patterns
Strategy: validation
Validate before calling
# check the githubrepo hook block before oxidized loads it
hook_cfg = YAML.load_file('/etc/oxidized/config')['hooks']['push_to_github']
missing = %w[remote_repo].reject { |k| hook_cfg.key?(k) }
raise ArgumentError, "githubrepo config missing: #{missing.join(', ')}" unless missing.empty? Type guard
def githubrepo_cfg_valid?(cfg)
cfg.is_a?(Hash) &&
(cfg['remote_repo'].is_a?(String) || (cfg['remote_repo'].is_a?(Hash) && cfg['remote_repo'].any?))
end Try / catch
begin
hook.validate_cfg!
rescue KeyError => e
abort "fix the hooks config: #{e.message}"
end Prevention
- Keep a per-hook-type config template listing every required key
- Deploy hook config through a pipeline that checks required keys before restart
- After editing hooks, start oxidized once in the foreground to surface validation errors
When it happens
Trigger: Declaring a hook with type: githubrepo whose YAML block lacks remote_repo: (for example only username/password were filled in), or remote_repo present but indented under a sibling key so it is not part of the hook's cfg hash.
Common situations: Copy-pasting the githubrepo example and filling in only credentials; renaming remote_repo to repo or url; indentation mistakes after editing the hooks: section.
Related errors
- hook.token is required
- hook.channel is required
- hook.jid is required
- hook.password is required
- hook.channel is required
AI-assisted analysis of ytti/oxidized@687ed4262d (2026-08-23).
Data as JSON: /api/errors/2d3f5c10a6ef4dcf.
Report an issue: GitHub.