llvm::object::createBinary returns an Expected<>, which requires not only checking the object for success, but also requires consuming the Error, if one was set.
Use LLDB_LOG_ERROR for this case, and change an existing similar log statement to use it as well, to make sure the Error is consumed even if the log channel is disabled.
There's an LLDB_LOG_ERROR macro, which makes sure to "handle" the error even if logging is disabled. It also handles all the .c_str() stuff *and* is able to prepend the name of the caller to the log message (if one requests that when enabling logging). So, overall, this could just be:
LLDB_LOG_ERROR(log, binary.takeError(), "Failed to create binary for file ({1}): {0}", file)