For files with codes less than 7 lines (including header), an "Invalid range" error occurs when updating header with AddHeader.
It seems that the number of lines in a file should be larger than the value of g:header_max_size, so the error could be avoided by adding blank lines to the file.