When a NETCONF server rejects an <edit-config> with an <rpc-error>, which fields should automation read to decide what failed and where?
answer
- strings, not numbers
- a fixed list in Appendix A
- a path to the offending node
- the human text is for humans
basics
~20 sAutomation should branch on error-tag, a fixed string from RFC 6241's Appendix A such as data-exists or invalid-value, refined by error-app-tag, and locate the problem with error-path. error-type gives the layer; error-message is for humans.
solid answer
~40 sAn `<rpc-error>` is structured. `error-type` names the layer that failed: `transport`, `rpc`, `protocol` or `application`. `error-tag` is the machine-readable condition, a string from RFC 6241's Appendix A such as `data-exists`, `data-missing`, `invalid-value`, `access-denied` or `in-use`; this is what code should branch on. `error-app-tag`, when present, refines it with a data-model-specific or implementation-specific condition. `error-path` is an absolute XPath to the node the error concerns, when one can be identified, and `error-info` carries mandated detail such as `bad-element`. `error-severity` is `error` or `warning`, though RFC 6241 defines no tag that uses warning. `error-message` is human-readable text and should be logged, not parsed. One request can yield several `<rpc-error>` elements, but a server is not required to report more than one.
code
xml · 11 lines<rpc-reply message-id="103"
xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<rpc-error>
<error-type>application</error-type>
<error-tag>data-exists</error-tag>
<error-severity>error</error-severity>
<error-path xmlns:t="http://example.com/schema/1.2/config">
/t:top/t:interface[t:name="uplink-1"]
</error-path>
</rpc-error>
</rpc-reply>go deeper
Recall that a NETCONF failure comes back as <rpc-error> inside <rpc-reply>, and that error-tag is a fixed string naming what went wrong.
Explain the fields: error-type for the layer, error-tag and error-app-tag for the condition, error-path for the node, error-info for detail, error-message for people.
Show defensive handling: branch on tags, tolerate missing optional fields, expect one error where there were several, and never retry by parsing human text.
Discuss a shared error taxonomy across NETCONF and RESTCONF clients keyed on error-tag, and what the platform should log for audit when an edit fails.
## Where errors appear Every NETCONF request is an `<rpc>` element with a `message-id` attribute, and every answer is an `<rpc-reply>` echoing it. A successful operation that returns no data answers `<ok/>`; a retrieval answers `<data>`; a failure answers one or more `<rpc-error>` elements. RFC 6241 Section 4.3 makes three promises worth memorising: - A server **MUST** return an `<rpc-error>` if any error condition occurs. - It **MAY** return several, but is **not required** to detect or report more than one, and need not check conditions in any particular order. - It **MUST NOT** return data-model-specific error detail the client lacks the access rights to see. Replies come back in request order: RFC 6241 requires a server to process `<rpc>` requests serially and to answer in the order they were received, even when a client pipelines several. ## The fields | Field | Content | Use in automation | |---|---|---| | `error-type` | `transport`, `rpc`, `protocol` or `application` | Which conceptual layer failed: secure transport, messages, operations or content. | | `error-tag` | A string from Appendix A | **The primary branch key.** | | `error-severity` | `error` or `warning` | Treat as `error`; RFC 6241 defines no tag that uses `warning`. | | `error-app-tag` | Data-model- or implementation-specific string | A finer key when present; the data-model value wins if both exist. | | `error-path` | Absolute XPath to the node involved | Which interface, which leaf, when one can be associated. | | `error-message` | Human-readable text, with `xml:lang` | Log it; never parse it. | | `error-info` | Protocol- or model-specific elements | Mandated detail, such as `bad-element`. | Optional means optional: `error-app-tag`, `error-path`, `error-message` and `error-info` are each absent when nothing appropriate applies. ## The error-tags an edit job meets Appendix A is normative and lists each tag with the error-types it may carry and any mandatory `error-info`. The ones an `<edit-config>` most often produces: 1. **`data-exists`**: a `create` operation hit data that already exists. 2. **`data-missing`**: a `delete` targeted absent data, or `default-operation none` met a level that does not exist in the target. 3. **`invalid-value`**: a parameter value is unacceptable; also returned when `<copy-config>` names the same source and target. 4. **`access-denied`**: authorization failed for the operation or the data. 5. **`in-use`** and **`lock-denied`**: a resource or lock is held by someone else; for `lock-denied`, `error-info` carries the holder's `session-id`. 6. **`operation-not-supported`**: the device does not implement what was asked. 7. **`malformed-message`**: the message could not be parsed; new in `:base:1.1`, and RFC 6241 says it must not be sent to old clients. 8. **`rollback-failed`**: a requested rollback, through `rollback-on-error` or `<discard-changes>`, did not complete. The older `partial-operation` tag, which listed succeeded, failed and skipped elements, is obsolete in RFC 6241 and should not be sent, so a client cannot rely on it to learn what an edit managed before it failed. ## Reading a reply RFC 6241's own example shows two errors from one edit, each with `error-type` `application`, `error-tag` `invalid-value`, an `error-path` naming a different interface, and an `error-message` such as "MTU value 25000 is not within range 256..9192". A robust client: - matches on `error-tag`, then on `error-app-tag` if it knows the data model; - uses `error-path` to tie the failure to an object in its own inventory; - treats several `<rpc-error>` elements as a list, and also handles a reply that stops at the first; - records `error-message` verbatim for the operator. ## Why strings and not numbers NETCONF error-tags are enumerated strings, not numeric codes. RESTCONF (RFC 8040), which carries the same data models over HTTP, maps each error-tag onto an HTTP status code, for example `data-exists` and `data-missing` to 409, and still returns the error-tag in the body. A client that handles both protocols should key its logic on the error-tag, which is common to both, rather than on the transport's status. ## Common mistakes - Matching on `error-message` text, which varies by implementation and language. - Assuming one `<rpc-error>` means one problem in the request. - Treating a missing `error-path` as a server bug; it is legitimately absent when no node can be associated. - Ignoring `error-type`: an `rpc`-layer `malformed-message` means the message could not be parsed at all, so resending the same bytes fails the same way. - Discarding `error-info`: for several tags Appendix A makes its content mandatory, such as `bad-element` naming the element at fault, which is often more precise than any message text.
- How should a NETCONF client handle a reply that carries only one <rpc-error> when the request had several bad values?Fix the reported error and expect that others may remain: RFC 6241 lets a server stop after the first error it detects and check conditions in any order. Running the corrected request with `test-only`, on a device advertising `:validate:1.1`, lets the client iterate on validation errors without changing the datastore each round.
- Why might an <rpc-error> for a denied write carry less detail than one for an invalid value?RFC 6241 forbids a server from returning application-level or data-model-specific error information the client lacks access rights to see. An `access-denied` error can therefore omit the path or detail that would reveal data the user may not read, so automation should not depend on `error-path` being present for authorization failures.
saying these in an interview costs you the question
- NETCONF errors are numeric codes, like HTTP status codes.
- Parse error-message text to decide whether to retry.
- A reply with several errors always lists every problem in the request.
- Warning severity is how NETCONF reports a non-fatal edit problem.
- An <rpc-error> always names the failing node in error-path.