>The lines “no @SQ lines in the header” and “missing header?” should tell you to check the header in the SAM file. Is there one? If not, you have to feed in your reference with the “-T” option. (seqanswer)
samtools view -Sb -T REF.fasta A1.sam > A1.bam &
would end the frustration.