pentaho/pentaho-kettle · error · Error
Can't fill a sorted list.
Error message
Can't fill a sorted list.
What it means
SortedList.fill throws because overwriting arbitrary positions with a single value (Array.prototype.fill semantics) would violate the list's sorted-order invariant. The method is intentionally implemented as unsupported on sorted lists.
Solutions
- Pre-populate a plain array then construct the SortedList from it
- Use add/addN to insert values so they are placed in sorted order
- Convert to a plain array with toArray() before filling
Example fix
// before sortedList.fill(0, 0, 5); // throws // after var arr = new Array(5).fill(0); var sl = new SortedList(arr);
Defensive patterns
Strategy: try-catch
Validate before calling
if (list.isSorted) {
throw new TypeError('fill is unsupported on SortedList');
} Try / catch
try {
list.fill(v, 0, n);
} catch (e) {
if (String(e.message).indexOf('fill a sorted list') >= 0) {
var arr = list.toArray(); arr.fill(v, 0, n); list.clear(); list.addN(arr);
} else throw e;
} Prevention
- Avoid Array.prototype.fill semantics on sorted collections
- Initialize contents before constructing the SortedList
- Use add/addN to control contents
When it happens
Trigger: Any call to sortedList.fill(value, start, end), directly or through array-generic helper functions.
Common situations: Array-generic utilities applied to a sorted list; initializing slots with a default value using code written for plain Lists/arrays.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- Can't copy within a sorted list.
- Can't do a indexed insert in a sorted list.
- Can't do a indexed replace in a sorted list.
- Can't reverse a sorted list.
- Append file in repository is not possible
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/f5cb34fa97aba70e.
Report an issue: GitHub.
Appendix: source
Thrown at plugins/core-ui/src/main/resources/app/pentaho/lang/SortedList.js:171
left = i + 1;
} else if(comparison > 0) {
right = i - 1;
} else {
return i;
}
}
// two's complement operation being used to
// return (x+1)*-1 in a hackish way
return ~left;
},
copyWithin: function() {
throw new Error("Can't copy within a sorted list.");
},
fill: function() {
throw new Error("Can't fill a sorted list.");
},
reverse: function() {
throw new Error("Can't reverse a sorted list.");
},
unshift: function() {
throw new Error("Can't do a indexed insert in a sorted list.");
},
insert: function() {
throw new Error("Can't do a indexed insert in a sorted list.");
},
replace: function() {
throw new Error("Can't do a indexed replace in a sorted list.");
},
View on GitHub (pinned to f3058517a1)