How to fix the MultipleObjectsReturned error in Hue

Published on 14 March 2014 in Administration / Development - 1 minute read - Last modified on 04 February 2020

When going on the Home page (/home) in Hue 3.0, this error could appear:

MultipleObjectsReturned: get() returned more than one DocumentPermission - it returned 2! Lookup parameters were {'perms': 'read', 'doc': }

This is fixed in Hue 3.6 and here is a way to repair it:

  1. Backup the Hue database

  2. Run the cleanup script

from desktop.models import DocumentPermission, Document

for document in Document.objects.all():


perm, created = DocumentPermission.objects.get_or_create(doc=document, perms=DocumentPermission.READ_PERM)

except DocumentPermission.MultipleObjectsReturned, ex:

\# We can delete duplicate perms of a document

dups = DocumentPermission.objects.filter(doc=document, perms=DocumentPermission.READ_PERM)

perm = dups[0]

for dup in dups[1:]:

print 'Deleting duplicate %s' % dup


comments powered by Disqus

More recent stories

19 May 2020
How to grant Ranger permissions for a new user on a Secure Cluster
Read More
06 May 2020
SQL Editor for Apache Flink SQL
Read More
05 May 2020
How to Configure Hue to authenticate with Apache Knox SSO on a Secure Cluster
Read More