Invenio 1: BibRank exception

I was getting several exceptions in Bibrank:

* 2015-01-15 08:32:17 -> NoOptionError: No option 'citation_loss_limit' in section: 'citation' (

** User details
No client information available

** Traceback details 

Traceback (most recent call last):
  File "/usr/lib64/python2.7/site-packages/invenio/", line 606, in task_init
    ret = _task_run(task_run_fnc)
  File "/usr/lib64/python2.7/site-packages/invenio/", line 1146, in _task_run
    if callable(task_run_fnc) and task_run_fnc():
  File "/usr/lib64/python2.7/site-packages/invenio/", line 159, in task_run_core
  File "/usr/lib64/python2.7/site-packages/invenio/", line 443, in citation
    return bibrank_engine(run)
  File "/usr/lib64/python2.7/site-packages/invenio/", line 356, in bibrank_engine
    func_object(rank_method_code, cfg_name, config)
  File "/usr/lib64/python2.7/site-packages/invenio/", line 68, in citation_exec
    dic, index_update_time = get_citation_weight(rank_method_code, config)
  File "/usr/lib64/python2.7/site-packages/invenio/", line 141, in get_citation_weight
    weights = process_and_store(updated_recids, config, chunk_size)
  File "/usr/lib64/python2.7/site-packages/invenio/", line 157, in process_and_store
    citation_loss_limit = int(config.get(function, "citation_loss_limit"))
  File "/usr/lib64/python2.7/", line 618, in get
    raise NoOptionError(option, section)
NoOptionError: No option 'citation_loss_limit' in section: 'citation'

** Stack frame details

This was solved by updating /opt/invenio/etc/bibrank/citation.cfg with citation_loss_limit = 50 and I also included some more options:

reference_via_doi= 999C5a
reference_via_record_id= 990C50
reference_via_isbn= 999C5i
citation_loss_limit = 50
collections =

Then it was solved 🙂

CDS Invenio: bibrank exceptions [SOLVED]

The problem

Our Invenio was spitting exceptions like the following:

Forced traceback (most recent call last)
  File "/usr/lib64/python2.4/site-packages/invenio/", line
150, in task_run_core
line 1210, in word_similarity
    return word_index(run)
line 839, in word_index
    update_rnkWORD(options["table"], options["modified_words"])
Traceback (most recent call last):
line 1114, in update_rnkWORD
    Nj[j] = Nj.get(j, 0) + math.pow(Gi[t] * (1 + math.log(tf[0])), 2)
OverflowError: math range error

More precisely, this one is related to record 4573:

Error when analysing the record 4573 (((3350, 'x\x9cu\x93\xdbr\xdc

But a lot of records (4573, 4336, 4487, 4337, … ) were producing similar errors every time my scheduled bibrank task was run…

The fix

[Thank you so much, Samuele Kaplun!]

This is normally due to word similarities indexes that accumulated too much
errors and need to be re-balanced. You can safely discard these exceptions
(though it’s true they might quickly fill your mailbox 🙂 ).

Usually bibrank word similarity indexes are built in a fast way that works
most of the time, but is approximate and lead to some approximation errors
after a certain usage period.

To solve this, you usually just need to schedule (e.g. weekly) a bibrank -R to
rebalance these indexes.

Try e.g. with:

$ sudo -u apache /opt/cds-invenio/bin/bibrank -R -wwrd -s7d -uadmin

and see if this solve your problem.

(See also this linkwhere this is
also short-explained).