Skip to content
Latchkey

HAProxy "parsing [cfg:line] unknown keyword" in CI

HAProxy hit a keyword it does not recognize in the section where it appears. The keyword is misspelled, removed in this HAProxy version, or only valid in a different section, so parsing stops with the file and line.

What this error means

haproxy -c fails with "parsing [haproxy.cfg:42] : unknown keyword 'X' in '<section>' section" and refuses to load.

haproxy
[ALERT] (1) : parsing [/etc/haproxy/haproxy.cfg:42] : unknown keyword 'reqrep' in 'backend' section.

Common causes

A deprecated or removed keyword

Keywords like reqrep were removed in newer HAProxy versions in favor of http-request, so an old config no longer parses.

A keyword used in the wrong section

A directive valid only in a frontend or global section appears in a backend, so it is unknown there.

How to fix it

Replace the keyword with the current form

  1. Read the file and line in the parse error to find the unknown keyword.
  2. Replace it with the supported directive for your HAProxy version.
  3. Re-run haproxy -c to confirm the config parses.
haproxy.cfg
# old:  reqrep ^([^\ ]*)\ /old/(.*) \1\ /new/\2
http-request set-path /new/%[path,regsub(^/old/,/)]

Pin the HAProxy version you validate against

Check the config with the same HAProxy version you deploy so keyword availability matches.

Terminal
docker run --rm -v "$PWD:/cfg" haproxy:2.9 \
  haproxy -c -f /cfg/haproxy.cfg

How to prevent it

  • Track keyword deprecations when upgrading HAProxy.
  • Validate config against the deployed HAProxy version in CI.
  • Keep directives in the sections that allow them.

Frequently asked questions

What causes "haproxy "unknown keyword""?
Keywords like reqrep were removed in newer HAProxy versions in favor of http-request, so an old config no longer parses.
How do I fix haproxy "unknown keyword"?
Replace the keyword with the current form

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card