Thank you for your responses!
I think I figured out the error. This happens when there's duplicate queries in the file (1400_to_4999_combined_protein_id_ac, which contains gi numbers). If I sort and output the unique gi numbers, the C++ error went away. The error "Protein BLAST database 'Pfam nr' does not exist in the NCBI servers" still exists, but rpsblast still runs and outputs the search results! I think that error is printed by default.
Based on my correspondence with the NCBI's blast-helpdesk, blast-2.6.0+ still accepts gi numbers as queries, at least for rpsblast!
Hope this is helpful for anyone who runs into the same problem as me!