# Buggy code
def _message(self, message_action_kind, msg):
    if message_action_kind == "get":
        self.instance.logger.info("Waiting for a message to get...")
        if not bool(self.instance._Bot__source_queues):
            self.instance.logger.warning("Bot has no source queue.")
            return

        # Never pops from source to internal queue, thx to disabling brpoplpush operation.
        # However, we have to wait manually till there is the message in the queue.
        pl = self.instance._Bot__source_pipeline
        pl.pipe.brpoplpush = lambda source_q, inter_q, i: pl.pipe.lindex(source_q, -1)
        while not (pl.pipe.llen(pl.source_queue) or pl.pipe.llen(pl.internal_queue)):
            time.sleep(1)
        self.pprint(self.instance.receive_message())
    elif message_action_kind == "pop":
        self.instance.logger.info("Waiting for a message to pop...")
        self.pprint(self.instance.receive_message())
        self.instance.acknowledge_message()
    elif message_action_kind == "send":
        if not bool(self.instance._Bot__destination_queues):
            self.instance.logger.warning("Bot has no destination queues.")
            return
        if msg:
            msg = self.arg2msg(msg)
            self.instance.send_message(msg)
            self.instance.logger.info("Message sent to output pipelines.")
        else:
            self.messageWizzard("Message missing!")


# Traceback (intelmq.lib.exceptions.KeyExists)
intelmqctl run abusech-feodo-domains-collector message send "{\"feed.accuracy\": 100.0, \"feed.name\": \"Abuse.ch Feodo Domains\", \"raw\": \"IyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMKIyBGZW9kbyBEb21haW4gQmxvY2tsaXN0ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICMKIyBHZW5lcmF0ZWQgb24gMjAxNy0wOC0xNyAxMTo0NjoyNSBVVEMgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICMKIyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICMKIyBGb3IgcXVlc3Rpb25zIHBsZWFzZSByZWZlciB0byBodHRwczovL2Zlb2RvdHJhY2tlci5hYnVzZS5jaC9ibG9ja2xpc3QvICMKIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMKIyBTVEFSVAojIEVORCAoMCBlbnRyaWVzKQo=\", \"__type\": \"Report\", \"feed.url\": \"https://feodotracker.abuse.ch/blocklist/?download=domainblocklist\", \"time.observation\": \"2017-08-17T11:46:25+00:00\", \"feed.provider\": \"Abuse.ch\"}"
/usr/lib64/python3.4/importlib/_bootstrap.py:579: ImportWarning: Not importing directory /usr/lib64/python3.4/site-packages/zope: missing __init__
_warnings.warn(msg.format(portions[0]), ImportWarning)
/usr/lib64/python3.4/importlib/_bootstrap.py:579: ImportWarning: Not importing directory /usr/lib64/python3.4/site-packages/mpl_toolkits: missing __init__
_warnings.warn(msg.format(portions[0]), ImportWarning)
/usr/lib64/python3.4/importlib/_bootstrap.py:579: ImportWarning: Not importing directory /usr/lib/python3.4/site-packages/logilab: missing __init__
_warnings.warn(msg.format(portions[0]), ImportWarning)
intelmqctl: Starting abusech-feodo-domains-collector...
Traceback (most recent call last):
File "/usr/local/bin/intelmqctl", line 9, in <module>
load_entry_point('intelmq==1.0.0', 'console_scripts', 'intelmqctl')()
File "/home/sebastian/dev/intelmq/intelmq/bin/intelmqctl.py", line 916, in main
return x.run()
File "/home/sebastian/dev/intelmq/intelmq/bin/intelmqctl.py", line 549, in run
results = args.func(**args_dict)
File "/home/sebastian/dev/intelmq/intelmq/bin/intelmqctl.py", line 559, in bot_run
return self.bot_process_manager.bot_run(**kwargs)
File "/home/sebastian/dev/intelmq/intelmq/bin/intelmqctl.py", line 142, in bot_run
console_type, dryrun, message_action_kind, msg)
File "/home/sebastian/dev/intelmq/intelmq/lib/bot_debugger.py", line 55, in __init__
self._message(message_kind, msg)
File "/home/sebastian/dev/intelmq/intelmq/lib/bot_debugger.py", line 108, in _message
self.instance.send_message(msg)
File "/home/sebastian/dev/intelmq/intelmq/lib/bot.py", line 723, in send_message
super(CollectorBot, self).send_message(*messages)
File "/home/sebastian/dev/intelmq/intelmq/lib/bot.py", line 710, in __add_report_fields
report.add("feed.name", self.parameters.feed)
File "/home/sebastian/dev/intelmq/intelmq/lib/message.py", line 191, in add
raise exceptions.KeyExists(key)
intelmq.lib.exceptions.KeyExists: key 'feed.name' already exists

# Fixed code
def _message(self, message_action_kind, msg):
    if message_action_kind == "get":
        self.instance.logger.info("Waiting for a message to get...")
        if not bool(self.instance._Bot__source_queues):
            self.instance.logger.warning("Bot has no source queue.")
            return

        # Never pops from source to internal queue, thx to disabling brpoplpush operation.
        # However, we have to wait manually till there is the message in the queue.
        pl = self.instance._Bot__source_pipeline
        pl.pipe.brpoplpush = lambda source_q, inter_q, i: pl.pipe.lindex(source_q, -1)
        while not (pl.pipe.llen(pl.source_queue) or pl.pipe.llen(pl.internal_queue)):
            time.sleep(1)
        self.pprint(self.instance.receive_message())
    elif message_action_kind == "pop":
        self.instance.logger.info("Waiting for a message to pop...")
        self.pprint(self.instance.receive_message())
        self.instance.acknowledge_message()
    elif message_action_kind == "send":
        if not bool(self.instance._Bot__destination_queues):
            self.instance.logger.warning("Bot has no destination queues.")
            return
        if msg:
            msg = self.arg2msg(msg)
            self.instance.send_message(msg, auto_add=False)
            self.instance.logger.info("Message sent to output pipelines.")
        else:
            self.messageWizzard("Message missing!")