First time here? Check out the FAQ!

What causes Internal server error on accessing some questions?

After upgrading to 0.7.50 we get and internal server error on loading some questions:

Upgrade steps:

pip install --upgrade askbot
python migrate --list    
python migrate
python syncdb --migrate
python collectstatic


python generate_post_snippets

The error

    list index out of range
    Request Method: GET
Django Version: 1.5.12
Python Version: 2.7.6
Installed Applications:
Installed Middleware:
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/" in get_response
  113.                         response = callback(request, *callback_args, **callback_kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/utils/" in _wrapped_view
  91.                     response = view_func(request, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/askbot/views/" in question
  513.                                 user=request.user
File "/usr/local/lib/python2.7/dist-packages/askbot/models/" in get_post_data_for_question_view
  1087.         post_data = self.get_cached_post_data(user=user, sort_method=sort_method)
File "/usr/local/lib/python2.7/dist-packages/askbot/models/" in get_cached_post_data
  1195.             post_data = self.get_post_data(sort_method)
File "/usr/local/lib/python2.7/dist-packages/askbot/models/" in get_post_data
  1245.             first_rev = post.get_earliest_revision()
File "/usr/local/lib/python2.7/dist-packages/askbot/models/" in get_earliest_revision
  1506.         rev = self.revisions.order_by('revision')[0]
File "/usr/local/lib/python2.7/dist-packages/django/db/models/" in __getitem__
  231.             return list(qs)[0]

Exception Type: IndexError at /question/198/from-windows-xp-to-windows-7/
Exception Value: list index out of range
Rupreck's avatar
asked 2015-02-13 11:06:20 -0500
edit flag offensive 0 remove flag close merge delete


add a comment see more comments

1 Answer


Looks like you have data corruption, to fix this specific error, run command:

python fix_revisionless_posts

There is a number of other commands that start with either fix_ or askbot_fix_

To see the list of commands, please look into directory askbot/management/commands.

Evgeny's avatar
answered 2015-02-13 12:11:14 -0500, updated 2015-02-13 12:32:21 -0500
edit flag offensive 0 remove flag delete link


Fixed. Thank-you very much for your help! This made 28 edits appear into the moderation queue. However selecting them and clicking either of the approve buttons failed until the 1st user was changed to 'Approved' within his Profile page. I am not sure why it didn't do that using the moderation button for users and posts. Please can you point me to where I can see the list of fix_ and askbot_fix_ commands?

Rupreck's avatar Rupreck (2015-02-13 12:25:32 -0500) edit

Possibly the fix command needs to be updated to temporarily disable the content moderation during the command execution. On the other hand you could disable the content moderation manually and then run the command.

Evgeny's avatar Evgeny (2015-02-13 12:39:36 -0500) edit

Thanks. After the change to the 1st user, the button worked for the rest. Site is working very well now. Thank-you for your continuing efforts with askbot, it really is a great piece of work.

Rupreck's avatar Rupreck (2015-02-13 12:50:11 -0500) edit
add a comment see more comments