ConfD User Community

Can't use "must" statement under for grouping

The following is my test yang model for “must” statement.

grouping test_group {
    container test {
      leaf test_paramater {
        type empty;
  list test {
    key name;
    leaf name {
      tailf:info "Unique service id";
      type string;

    uses ncs:service-data;
    ncs:servicepoint test-servicepoint;

    leaf flag {
      type boolean;
    uses test_group {
       must "../flag = 'true'";      //it works fine with "when" statement

I want to use the “must” condition for the grouping using. But it throws the compile error with “yang/test.yang:48: error: unexpected keyword ‘must’”.

It works fine when I change the statement to “when”, but I want to know is there any particular limitation can not use “must” for grouping?

See RFC 7950: The YANG 1.1 Data Modeling Language under “The uses’s Substatements”
You cannot have a “must” statement in a “uses” statement according to the YANG RFC. Makes sense when you read the “uses” statement definition.

Thanks for your quick response! It make sense!