{"action":"closed","issue":{"url":"https://api.github.com/repos/opencog/opencog/issues/652","labels_url":"https://api.github.com/repos/opencog/opencog/issues/652/labels{/name}","comments_url":"https://api.github.com/repos/opencog/opencog/issues/652/comments","events_url":"https://api.github.com/repos/opencog/opencog/issues/652/events","html_url":"https://github.com/opencog/opencog/issues/652","id":30440643,"number":652,"title":"PLN chainer throws, calls rule.calculate with null argument","user":{"login":"cosmoharrigan","id":2343485,"avatar_url":"https://avatars.githubusercontent.com/u/2343485?v=3","gravatar_id":"","url":"https://api.github.com/users/cosmoharrigan","html_url":"https://github.com/cosmoharrigan","followers_url":"https://api.github.com/users/cosmoharrigan/followers","following_url":"https://api.github.com/users/cosmoharrigan/following{/other_user}","gists_url":"https://api.github.com/users/cosmoharrigan/gists{/gist_id}","starred_url":"https://api.github.com/users/cosmoharrigan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cosmoharrigan/subscriptions","organizations_url":"https://api.github.com/users/cosmoharrigan/orgs","repos_url":"https://api.github.com/users/cosmoharrigan/repos","events_url":"https://api.github.com/users/cosmoharrigan/events{/privacy}","received_events_url":"https://api.github.com/users/cosmoharrigan/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/opencog/opencog/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/opencog/opencog/labels/pln","name":"pln","color":"f7c6c7"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2014-03-29T09:45:04Z","updated_at":"2015-04-10T05:52:47Z","closed_at":"2015-04-10T05:52:47Z","body":"The PLN chainer sometimes calls rule.calculate with a null argument. The backtrace is:\r\n```\r\nterminate called after throwing an instance of 'opencog::RuntimeException'\r\n  what():  PyMindAgent triggered runtime exception.Traceback (most recent call last):\r\n  File \"agent_finder.pyx\", line 137, in opencog.agent_finder.run_agent (/home/cosmo/opencog/build/opencog/cython/opencog/agent_finder.cpp:2942)\r\n  File \"../opencog/python/pln/examples/tuffy/class/class_agent.py\", line 59, in run\r\n    AndCreationRule(self.chainer, num_predicates), [antecedent])\r\n  File \"/home/cosmo/opencog/opencog/python/pln/chainers.py\", line 412, in backward_step\r\n    results = self._apply_backward(rule, target_outputs=target_atoms)\r\n  File \"/home/cosmo/opencog/opencog/python/pln/chainers.py\", line 631, in _apply_backward\r\n    return self.apply_rule(rule, specific_inputs, final_outputs)\r\n  File \"/home/cosmo/opencog/opencog/python/pln/chainers.py\", line 705, in apply_rule\r\n    output_tvs = rule.calculate(inputs)\r\n  File \"/home/cosmo/opencog/opencog/python/pln/rule.py\", line 76, in calculate\r\n    result_tvs = self.formula(tvs)\r\n  File \"/home/cosmo/opencog/opencog/python/pln/rules/formulas.py\", line 190, in andFormula\r\n    return [TruthValue(total_strength, makeUpCount(tvs))]\r\n  File \"/home/cosmo/opencog/opencog/python/pln/rules/formulas.py\", line 35, in makeUpCount\r\n    return min(tv.count for tv in tvs)\r\nValueError: min() arg is an empty sequence\r\n```\r\nIt seems that the ```apply_rule``` method calls ```rule.calculate``` with a null value for the ```inputs``` argument [here](https://github.com/opencog/opencog/blob/master/opencog/python/pln/chainers.py#L692), because ```_apply_backward``` did not declare any inputs, but it still invoked ```apply_rule``` [here](https://github.com/opencog/opencog/blob/master/opencog/python/pln/chainers.py#L619)."}}