This is very similar to this question: sprintf invalid format '%d', but it is different. sprintf() gives an error formatting to "%d" for c(NA_integer_, 1), but not c(1, NA_integer).
sprintf("%d", NA)
#> [1] "NA"
sprintf("%d", 1)
#> [1] "1"
sprintf("%d", NA_integer_)
#> [1] "NA"
sprintf("%d", c(1, NA_integer_))
#> [1] "1"  "NA"
sprintf("%d", c(NA_integer_, 1))
#> Error in sprintf("%d", c(NA_integer_, 1)) : 
#>   invalid format '%d'; use format %f, %e, %g or %a for numeric objects
Where it differs from the question above is that sprintf("%d", NA_integer_) works fine. Also, NA_integer_ is explicitly an integer, so surely that can't be the problem?