celery/celery · error · SecurityError

Still root uid after drop privileges!

Error message

Still root uid after drop privileges!

What it means

Error "Still root uid after drop privileges!" thrown in celery/celery.

Source

Thrown at celery/platforms.py:553

    If only GID is specified, only the group is changed.
    """
    if sys.platform == 'win32':
        return
    if os.geteuid():
        # no point trying to setuid unless we're root.
        if not os.getuid():
            raise SecurityError('contact support')
    uid = uid and parse_uid(uid)
    gid = gid and parse_gid(gid)

    if uid:
        _setuid(uid, gid)
    else:
        gid and setgid(gid)

    if uid and not os.getuid() and not os.geteuid():
        raise SecurityError('Still root uid after drop privileges!')
    if gid and not os.getgid() and not os.getegid():
        raise SecurityError('Still root gid after drop privileges!')


def _setuid(uid, gid):
    # If GID isn't defined, get the primary GID of the user.
    if not gid and pwd:
        gid = pwd.getpwuid(uid).pw_gid
    # Must set the GID before initgroups(), as setgid()
    # is known to zap the group list on some platforms.

    # setgid must happen before setuid (otherwise the setgid operation
    # may fail because of insufficient privileges and possibly stay
    # in a privileged group).
    setgid(gid)
    initgroups(uid, gid)

    # at last:

View on GitHub (pinned to 571efe8120)

When it happens

Trigger: Thrown at celery/platforms.py:553 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of celery/celery@571efe8120 (2026-08-04). Data as JSON: /data/errors/edba20870adaff24.json. Report an issue: GitHub.