Domain 3 of 4 · Chapter 3 of 6

Diagnosing Automation Problems

Unlock the complete study guide + 1,040 practice questions across 16 full exams.

Bundled into the existing Designing, Deploying and Managing Network Automation Systems premium course — no separate purchase.

14-day money-back guarantee — no questions asked.

Included in this chapter:

  • Triage by layer, from the wire up
  • When the server answers: HTTP status codes
  • Errors past the status line: RESTCONF and NETCONF
  • When the client never gets an answer
  • Reading a Python traceback
  • Exam-pattern recognition

HTTP status: root cause and the correct fix

StatusMeaningLikely root causeCorrect fix
400 Bad RequestMalformed requestInvalid JSON or wrong encodingFix the body and Content-Type
401 UnauthorizedNot authenticatedMissing, invalid, or expired credentialSend or refresh the token
403 ForbiddenAuthenticated, not permittedCaller lacks the required privilegeGrant the role; resending creds will not help
404 Not FoundWrong targetBad URL or RESTCONF/YANG pathCorrect the resource path
409 ConflictResource state clashPOST to a resource that already existsPUT to replace or PATCH to merge
415 Unsupported Media TypeWrong Content-TypeBody not application/yang-data+jsonSet the correct Content-Type header
429 Too Many RequestsRate limitedToo many calls in the windowHonor Retry-After, then back off
5xx (500/502/503)Server-side faultServer error, bad gateway, or outageRetry the same request with backoff

Decision tree

1. Connectivity TCP reached? ConnectionError / Timeout fix DNS, host, port, firewall fail pass 2. TLS cert trusted? SSLError: CERTIFICATE_VERIFY_FAILED trust the correct CA (not verify=False) fail pass 3. Auth 401 or 403? 401: refresh token 403: grant permission fail pass 4. Request data body / path / verb valid? 400 / 404 / 409 / 415 or error-tag fix body, path, verb, or Content-Type fail pass All client layers pass: 2xx success, or a 5xx / 429 is server-side retry with backoff; honor Retry-After

Cheat sheet

  • 401 vs 403 root causes
  • 400 vs 404 in REST/RESTCONF
  • 429 signals rate limiting
  • 5xx retryable, 4xx needs a fix
  • RESTCONF error payload
  • NETCONF rpc-error element
  • 415 Unsupported Media Type
  • 409 Conflict on POST
  • Read a traceback bottom-up
  • ConnectionError vs HTTP status
  • Connect vs read timeout
  • JSONDecodeError points to a non-JSON body
  • Isolate the failing layer first
  • CERTIFICATE_VERIFY_FAILED
  • A newly-401 call means an expired token

Unlock with Premium — includes all practice exams and the complete study guide.

References

  1. https://requests.readthedocs.io/en/latest/user/quickstart/
  2. https://requests.readthedocs.io/en/latest/user/advanced/
  3. https://www.rfc-editor.org/rfc/rfc9110
  4. https://www.cisco.com/c/en/us/td/docs/ios-xml/ios/prog/configuration/1717/b_1717_programmability_cg/m_1717_prog_restconf.html
  5. https://www.rfc-editor.org/rfc/rfc8040
  6. https://www.rfc-editor.org/rfc/rfc6585
  7. https://www.rfc-editor.org/rfc/rfc6241
  8. https://docs.python.org/3/tutorial/errors.html
  9. https://docs.python.org/3/library/traceback.html