What's wrong with it. I want to remove all interfaces

netconf request as

<?xml version="1.0" encoding="utf-8"?>
<rpc message-id="225" xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<edit-config>
<target><candidate/></target>
<error-option>rollback-on-error</error-option>
<config>
<interfaces xmlns="http://openconfig.net/yang/interfaces" xmlns:oc-if="http://openconfig.net/yang/interfaces" nc:operation="remove"></interfaces></config>
</edit-config>
</rpc>

get error as


<?xml version="1.0" encoding="UTF-8"?>
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="225" xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0"><rpc-error>
<error-type>application</error-type>
<error-tag>data-missing</error-tag>
<error-severity>error</error-severity>
<error-app-tag>instance-required</error-app-tag>
<error-path xmlns:oc-lldp="http://openconfig.net/yang/lldp">
    /rpc/edit-config/config/oc-lldp:lldp/oc-lldp:interfaces/oc-lldp:interface[oc-lldp:name='gei-0/0/0/1']/oc-lldp:config/oc-lldp:name
  </error-path><error-message xml:lang="en">illegal reference /lldp/interfaces/interface[name='gei-0/0/0/1']/config/name</error-message><error-info xmlns:tailf="http://tail-f.com/ns/netconf/params/1.1"  xmlns:oc-lldp="http://openconfig.net/yang/lldp" xmlns:oc-if="http://openconfig.net/yang/interfaces">
<tailf:bad-keyref>
<tailf:bad-element>/oc-lldp:lldp/oc-lldp:interfaces/oc-lldp:interface[oc-lldp:name='gei-0/0/0/1']/oc-lldp:config/oc-lldp:name</tailf:bad-element>
<tailf:missing-element>/oc-if:interfaces/oc-if:interface[oc-if:name='gei-0/0/0/1']/oc-if:name</tailf:missing-element>
</tailf:bad-keyref>
</error-info>
</rpc-error>
</rpc-reply>

The interfaces and lldp configuration in my ConfD Basic as :
netconf-console --user=admin --password=admin --port=830 --get -x “/lldp/interfaces/interface[name=‘gei-0/0/0/1’]”

<?xml version="1.0" encoding="UTF-8"?>
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1">
  <data>
    <lldp xmlns="http://openconfig.net/yang/lldp">
      <interfaces>
        <interface>
          <name>gei-0/0/0/1</name>
          <config>
            <name>gei-0/0/0/1</name>
          </config>
          <state>
            <enabled>true</enabled>
          </state>
        </interface>
      </interfaces>
    </lldp>
  </data>
</rpc-reply>

netconf-console --user=admin --password=admin --port=830 --get -x “/interfaces/interface[name=‘gei-0/0/0/1’]”

<?xml version="1.0" encoding="UTF-8"?>
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1">
  <data>
    <interfaces xmlns="http://openconfig.net/yang/interfaces">
      <interface>
        <name>gei-0/0/0/1</name>
        <config>
          <name>gei-0/0/0/1</name>
          <type xmlns:ianaift="urn:ietf:params:xml:ns:yang:iana-if-type">ianaift:ethernetCsmacd</type>
        </config>
        <state>
          <loopback-mode>false</loopback-mode>
          <enabled>true</enabled>
          <forwarding-viable xmlns="http://openconfig.net/interfaces/sdn-ext">true</forwarding-viable>
          <tpid xmlns="http://openconfig.net/yang/vlan" xmlns:oc-vlan-types="http://openconfig.net/yang/vlan-types">oc-vlan-types:TPID_0X8100</tpid>
        </state>
        <hold-time>
          <state>
            <up>0</up>
            <down>0</down>
          </state>
        </hold-time>
        <ethernet xmlns="http://openconfig.net/yang/interfaces/ethernet">
          <state>
            <auto-negotiate>true</auto-negotiate>
            <standalone-link-training>false</standalone-link-training>
            <enable-flow-control>false</enable-flow-control>
          </state>
          <poe xmlns="http://openconfig.net/yang/poe">
            <state>
              <enabled>true</enabled>
            </state>
          </poe>
        </ethernet>
        <tunnel xmlns="http://openconfig.net/yang/interfaces/tunnel">
          <ipv4>
            <proxy-arp>
              <state>
                <mode>DISABLE</mode>
              </state>
            </proxy-arp>
            <unnumbered>
              <state>
                <enabled>false</enabled>
              </state>
            </unnumbered>
            <state>
              <enabled>true</enabled>
              <dhcp-client>false</dhcp-client>
            </state>
          </ipv4>
          <ipv6>
            <router-advertisement>
              <state>
                <suppress>false</suppress>
              </state>
            </router-advertisement>
            <unnumbered>
              <state>
                <enabled>false</enabled>
              </state>
            </unnumbered>
            <state>
              <enabled>true</enabled>
              <dup-addr-detect-transmits>1</dup-addr-detect-transmits>
              <dhcp-client>false</dhcp-client>
            </state>
          </ipv6>
        </tunnel>
      </interface>
    </interfaces>
  </data>
</rpc-reply>

The type of /lldp/interfaces/interface/name is base-interface-ref, i.e. leafref to /interfaces/interface/name. So you cannot delete a interface instance and leave dangling references to it, and that’s what the error message says.

Now, you are targeting the candidate datastore where it is ok to have invalid configuration; but you are also sending test-option=test-then-set, because that’s the default, so if you really intend to delete the interface and keep the references to it, you need to add <test-option>set</test-option> to your edit-config message.