appsmith icon indicating copy to clipboard operation
appsmith copied to clipboard

[Bug]: IndexOutOfBoundsException: Source emitted more than one item

Open sentry[bot] opened this issue 3 years ago • 1 comments

Sentry Issue: APPSMITH-4EC

IndexOutOfBoundsException: Source emitted more than one item
    at reactor.core.publisher.MonoSingle$SingleSubscriber.onNext(MonoSingle.java:134)

sentry[bot] avatar Oct 12 '22 09:10 sentry[bot]

@hiteshjoshi @trishaanand seeing this crash in the update permissions flow

Nikhil-Nandagopal avatar Oct 12 '22 09:10 Nikhil-Nandagopal

There are users in the DB which are assigned multiple roles in a workspace so update role is getting multiple roles to unassign. Crash can be fixed with PR but need to investigate how we reached at this point and what we can do to correct the data.

Used the following query to find such workspaces.

var map = function() {
    if(this.defaultWorkspaceId != null)
        emit(this.defaultWorkspaceId, this.assignedToUserIds);
};

var reduce = function(defaultWorkspaceId, assignedToUserIds) {
    //2d array to 1d array
    assignedToUserIds = [].concat.apply([], assignedToUserIds);
    // set from array
    var set = new Set(assignedToUserIds);
    // if there are duplicates then length will be different
    return assignedToUserIds.length !== set.size;
};

var filter = function(result) {
    return result.value;
};

var transform = function(result) {
    return result._id;
};

db.getCollection("permissionGroup").mapReduce(map, reduce, {"out": {"inline": 1}}).results.filter(filter).map(transform);

sidhantgoel avatar Nov 29 '22 15:11 sidhantgoel

@infinitetrooper @trishaanand we're still seeing this issue

Nikhil-Nandagopal avatar Jan 16 '23 09:01 Nikhil-Nandagopal

@trishaanand - Could this be the cause of the error Joseph tagged today as well?

https://theappsmith.slack.com/archives/CGBPVEJ5C/p1673802145166369

infinitetrooper avatar Jan 16 '23 09:01 infinitetrooper

Closing as it's stale, reopen if the error reappears.

infinitetrooper avatar Jun 06 '23 15:06 infinitetrooper