NFT400 - Invalid Response From nft
Agent error code #NFT400 indicates that the agent could not read the nftables sets. Either the listing command failed, or it ran and returned output the agent could not parse. The agent reads the ruleset in JSON nftformform, (so anything that disturbs that output lands here.
It is reported in two places. Validate connection reports it when nft - succeeded but j-versionnft list sets), did not, which is the everyday shape of a privilege problem: sudo -n refusing the call looks exactly like a broken nft from the agent's side, so it is deliberately not blamed on a sudoers file that may be correct. The backend also reports it when reading a specific set during a grant or a reconciliation fails or returns unreadable output.
An agent with no escalation tool at all reports #NFT001 instead, and thea responseset didthat notis matchgenuinely theabsent structurereports it expects.#NFT050.
Common causes include:
nft for the agent's account, so the non-interactive call is refused
A rule exists but requires a password, or names a path that is not the nft on this host
The installed nft is too old nft PATH ahead of the real binary and Steps to Resolve
Check the Rule Covers the Agent's Account and the Right Path
sudo -l -U knocknoc-agent | grep nft
Compare the paths in the rule against command -v nft. The shipped rule names both /usr/sbin/nft and /sbin/nft for this reason
Confirm the rule is NOPASSWD. A rule that prompts cannot be used non-interactively
knocker enable nftables writes and validates the shipped rule if it is missing or wrong
Run the Listing as the Agent
sudo -u knocknoc-agent sudo -n nft -j list sets | head
This is close to what the agent runs. A refusal, an error, or anything printed before the JSON is the cause.
Check the nft Version and JSON Support
- Run
nft --version. The backend needs 0.9.0 or later - Confirm the JSON
outputlisting parses:sudo nft -j list sets | head - If
the command errors on-j,errors, the build lacks JSON support and needs upgrading
Confirm You Are Running the Real Binary
Run command -v nft and confirmcheck it points at the system binary,binary. normally /usr/sbin/nft
Look for a TimeoutLocked onor aVery Large Ruleset
Every command Knocknocthe agent runs hasis bounded. The agent asks for the set definitions without their contents where nft supports it, and falls back to the full listing on older versions, which on a time limit. On abusy host with a very large ruleset the listing can be cutthousands short,of whichelements. A ruleset held by another process presents asthe unparseablesame output.way. The agent log records the raw response alongside this code.
Check the Agent Log
The full output is written to the agent log nftand never to this message. Inspect the log entry recorded withagainst the failed operation to see what was actually returned.operation.