anchor.diff:  decode_avps(Name, Bin, #{module := Mod, decode_format := Fmt} = Opts) ->
       Strict = mget(strict_arities, Opts, decode),
       [AM, Avps, Failed | Rec]
  -        = decode(Bin, Name, Mod, Fmt, Strict, Opts, #{}),
  +        = decode(Bin, Name, Mod, Fmt, Strict, Opts, 0, #{}),
       %% AM counts the number of top-level AVPs, which missing/5 then
       %% uses when appending 5005 errors.
       {reformat(Name, Rec, Strict, Mod, Fmt),
  
positive.code:        Fmt,
         Strict,
         Opts,
         AM) ->
      decode(Rest,
             Code,
  
negative.code:            Fmt,
             Strict,
             Opts,
             Idx,
             AM);
  
  decode(<<>>, Name, Mod, Fmt, Strict, _, _, AM) ->
      [AM, [], [] | newrec(Fmt, Mod, Name, Strict)];
  
  decode(Bin, Name, Mod, Fmt, Strict, _, Idx, AM) ->
      Avp = #diameter_avp{data = Bin, index = Idx},
      [AM, [Avp], [{5014, Avp}] | newrec(Fmt, Mod, Name, Strict)].
  
  %% decode/14
  
  decode(Bin, Code, Vid, DataLen, Pad, M, P, Name, Mod, Fmt, Strict, Opts0,
         Idx, AM0) ->
      case Bin of
          <<Data:DataLen/binary, _:Pad/binary, T/binary>> ->
              {NameT, AvpName, Arity, {I, AM}}
                  = incr(Name, Code, Vid, M, Mod, Strict, Opts0, AM0),
  
              Opts = setopts(NameT, Name, M, Opts0),
  