Support Questions
Find answers, ask questions, and share your expertise

Error 500 when adding new slice in Superset

New Contributor

Hey everyone,

I have a HDP 2.6.1 cluster (4 nodes), with HDF management pack installed. Druid (therefore Superset) is installed, started and seems OK in Ambari. When I want to add new slice in Superset (http://superset_node.local:9088/slicemodelview/add) I receive this stacktrace:

        Traceback (most recent call last):
  File "/usr/hdp/", line 1982, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/hdp/", line 1614, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/hdp/", line 1517, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/hdp/", line 33, in reraise
    raise value
  File "/usr/hdp/", line 1612, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/hdp/", line 1598, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/usr/hdp/", line 26, in wraps
    return f(self, *args, **kwargs)
  File "/usr/hdp/", line 855, in add
    redirect_url = "/r/msg/?url={}&msg={}".format(url, msg)
UnboundLocalError: local variable 'url' referenced before assignment

The function it references:

class SliceModelView(SupersetModelView, DeleteMixin):  # noqa
    datamodel = SQLAInterface(models.Slice)
    can_add = False
    label_columns = {
        'datasource_link': 'Datasource',
    list_columns = [
        'slice_link', 'viz_type', 'datasource_link', 'creator', 'modified']
    edit_columns = [
        'slice_name', 'description', 'viz_type', 'owners', 'dashboards',
        'params', 'cache_timeout']
    base_order = ('changed_on', 'desc')
    description_columns = {
        'description': Markup(
            "The content here can be displayed as widget headers in the "
            "dashboard view. Supports "
            "<a href=''>"
        'params': _(
            "These parameters are generated dynamically when clicking "
            "the save or overwrite button in the explore view. This JSON "
            "object is exposed here for reference and for power users who may "
            "want to alter specific parameters."),
        'cache_timeout': _(
            "Duration (in seconds) of the caching timeout for this slice."
    base_filters = [['id', SliceFilter, lambda: []]]
    label_columns = {
        'cache_timeout': _("Cache Timeout"),
        'creator': _("Creator"),
        'dashboards': _("Dashboards"),
        'datasource_link': _("Datasource"),
        'description': _("Description"),
        'modified': _("Last Modified"),
        'owners': _("Owners"),
        'params': _("Parameters"),
        'slice_link': _("Slice"),
        'slice_name': _("Name"),
        'table': _("Table"),
        'viz_type': _("Visualization Type"),

    def pre_update(self, obj):

    def pre_delete(self, obj):

    @expose('/add', methods=['GET', 'POST'])
    def add(self):
        widget = self._add()
        if not widget:
            return redirect(self.get_redirect())

        sources = SourceRegistry.sources
        for source in sources:
            ds = db.session.query(SourceRegistry.sources[source]).first()
            if ds is not None:
                url = "/{}/list/".format(ds.baselink)
                msg = _("Click on a {} link to create a Slice".format(source))

        redirect_url = "/r/msg/?url={}&msg={}".format(url, msg)
        return redirect(redirect_url)

On the cluster there's a MySQL installed. A database and a user 'superset' is created, access granted for the user. In Ambari everything seems to configured properly. I tried to reinstall and reconfigure Druid but the problem is the same again.

Thanks for the help in advance.


New Contributor

I don't know if you still have the problem but I faced the same issue in our cluster (2.6.0) and the problem is that the

"Broker Port" information inside the Druid cluster created by ambari was not good. It should be 8082


New Contributor

The Druid Broker port is already set to 8082. 😞


I ran into the same issue

there seems to be a bug fix in place or at least a redirection in place

you can edit the as referenced above under /usr/hdp/current/druid-superset/lib/python3.4/site-packages/superset


you will need to restart superset after the modification

Hello Attila Fabian, did you solve this problem?, I`m geting the same error when I try to create a new slice. If Yes can you explain the solution?.


New Contributor


Unfortunately I couldn't solve the problem, I gave up using Druid. 😞

Hope you can solve it.