Why can't LLVM parse IR?

LLVM version: 16
IR version: 10

I’ve recently been trying to use the LLVM parser.
When I use
std::unique_ptr<llvm::MemoryBuffer> buffer = llvm::MemoryBuffer::getMemBuffer(llvm::StringRef(ir)); to get the buffer for use in the subsequent parseIR function I found that buffer is I found the buffer to be a null pointer and LLVM didn’t report any error during execution.

I then switched to the parseIRFile function, taking the path to the IR file as input, and again, the returned module was a null pointer.

I’m sure it’s not due to a versioning issue, since the getMemBuffer and parseIRFile functions can return non-null pointers on my little example.