I run mongorestore on my local mongodb with one instance . Occationally I see "NotWritableMaster" error

Some times when I run mongorestore on my local nodes I see following error

pymongo.errors.NotPrimaryError: not primary, full error: {'topologyVersion': {'processId': ObjectId('65f338afa4a28c93b0e5b66a'), 'counter': 5}, 'ok': 0.0, 'errmsg': 'not primary', 'code': 10107, 'codeName': 'NotWritablePrimary', '$clusterTime': {'clusterTime': Timestamp(1710438576, 6), 'signature': {'hash': b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', 'keyId': 0}}, 'operationTime': Timestamp(1710438576, 5)}

my mongo instance is single node and used for testing. How to avoid this error