Skip to main content

202150 - Invalid or Unexpected Response from Fortinet Device

Agent error code #202150 indicates that the Fortinet device returned a response that the agent could not parse or that did not match the expected format. The request was sent and a response was received, but the response content was invalid.

This error is distinct from connection (#202000) or authentication (#202001) failures. Error #202150 means communication was established and the request was processed, but the response was not in the expected JSON-RPC or REST API format.

Common causes include:

  • The configured URL is not pointing to the correct API endpoint (e.g., pointing to a web UI page instead of the JSON-RPC endpoint)
  • A web proxy, load balancer, or captive portal is intercepting the request and returning an HTML page instead of a JSON response
  • The FortiManager or FortiGate firmware version is not compatible with the API calls being made
  • FortiManager returned an error code indicating invalid parameters (JSON-RPC status -6)
  • The device returned a malformed or truncated JSON response (e.g., due to a timeout or resource constraint)

Steps to Resolve

Verify the URL Configuration

  1. In the Knocknoc admin interface, check the URL configured for the Fortinet backend
  2. For FortiManager: the URL should point to the FortiManager's base URL (e.g., https://fmg.example.com). The agent appends /jsonrpc automatically.
  3. For FortiGate (Direct): the URL should point to the FortiGate's base URL (e.g., https://fw.example.com). The agent appends API paths automatically.
  4. Do not include trailing slashes or API paths in the URL

Check for Intercepting Proxies

  1. If there is a web proxy, load balancer, or captive portal between the agent and the Fortinet device, it may be intercepting API requests
  2. Test by making a direct API call from the agent host:
    curl -k https://<hostname>/jsonrpc
    
  3. The response should be JSON. If you receive HTML, an intermediary is intercepting the request.

Check Agent Logs for Details

  1. Review the agent logs for the full error message and the raw response body
  2. The log entry will include the response that could not be parsed, which helps identify the source of the problem
  3. Look for "invalid or unexpected response" or "failed to parse" messages

Verify Firmware Compatibility

  1. Ensure the FortiGate or FortiManager firmware version supports the API operations being used
  2. Dynamic entry push (/api/v2/monitor/system/external-resource/dynamic) requires FortiOS 7.2.1 or later
  3. FortiManager JSON-RPC proxy (/sys/proxy/json) support varies by FortiManager version

Still Having Issues?

We can help you out, contact us at support@knocknoc.io.