Per the LRM, $sformat has the following signature: variable_format_string_output_function ::= $sformatf ( format_string [ , list_of_arguments ] ) Your code doesn’t follow this signature