Unfortunately, bam validate does not currently check the tags. Since it doesn't try to parse the tags, it doesn't encounter the problem.
That error means the code found a tag type that is not A, c, C, s, S, i, I, Z, B, f.
It should print the name of the tag and the type, but it looks like it is printing garbage, so maybe the parsing is messed up and what the code thinks is a tag isn't.
Note: the 'H' type is not currently supported.
Another potential issue could be an incorrect parsing of one of the supported types.
If it does not take too long before you encounter the error, I would suggest narrowing it down to find out which read is causing the error.
You can do this by doing something like:
bin/bam yourBam.bam - > /dev/null
You should see the same error message, but at the end it should say something like:
Number of records read = 12
Number of records written = 11
The number of records read will tell you the record number that is failing since bamUtil stops reading records after it encounters the error.
Since BamUtil is having trouble parsing this record, I would see if samtools can do better.
You can try pulling out the failed record, in this case record 12:
samtools view yourBam.bam | head -n 12 | tail -n 1
This will help us see the tag types.
Unfortunately, the error might be in the BAM representation of the tag so may not be obvious when we look at the tags.
Are you familiar with a debugger? That is how I would typically debug this situation.
If not, I can probably give you some updated code that will print out additional information or the entire BAM record when it hits this error.