OrchardCMS/OrchardCore · error · TypeError
Invalid attempt to spread non-iterable instance. In order…
Error message
Invalid attempt to spread non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.
What it means
vuedraggable's internal _toConsumableArray helper calls _iterableToArray, which returns undefined when the spread target lacks a [Symbol.iterator] method, so _nonIterableSpread() throws this TypeError. It means vuedraggable tried to spread a value that is neither an array nor an iterable (e.g. null, undefined, or a plain object).
Solutions
- Initialize the v-model/list binding with an empty array [] instead of null/undefined
- Guard rendering with v-if until the list data is loaded
- Pass the array itself (items), not a wrapper object, to v-model/list
- Check computed properties feeding the list — they must always return an array
Example fix
// before <draggable v-model="items"> ... // items may be null // after <draggable v-model="items || []"> ... or v-if="Array.isArray(items)" wrapper
Defensive patterns
Strategy: type-guard
Validate before calling
if (!Array.isArray(items)) { items = []; } Type guard
function isIterable(v){ return v != null && typeof v[Symbol.iterator] === 'function'; } Try / catch
try { renderDraggable(items); } catch (e) { if (e instanceof TypeError && e.message.includes('non-iterable')) { items = []; retryRender(); } } Prevention
- Always initialize list-bound state to []
- Use v-if until async data arrives
- Never bind objects/null to draggable v-model
When it happens
Trigger: Binding v-model or the 'list' prop of <draggable> to a non-array value (object, null, undefined) or spreading a non-iterable inside a draggable slot/template while dragging re-renders the list.
Common situations: Initializing the bound list asynchronously (undefined until data loads), accidentally passing an object like {items: [...]} instead of the array, or Vuex state not yet populated.
Understand the failure class
Background: Type mismatch errors: IllegalArgumentException, TypeError and type guards across 150 open-source libraries — this error's family across 150 libraries.
Related errors
- Standalone host is missing a <div id="media-gallery"> mount…
- Invalid attempt to spread non-iterable instance. In order…
- Invalid attempt to destructure non-iterable instance. In…
- Failed to load
- is missing the required "orchardBaseUrl" field.
AI-assisted analysis of OrchardCMS/OrchardCore@4306c0717f (2026-09-13).
Data as JSON: /api/errors/482c68439be6ffdd.
Report an issue: GitHub.
Appendix: source
Thrown at src/OrchardCore.Modules/OrchardCore.Resources/wwwroot/Vendor/vue-draggable-2.24.3/vuedraggable.umd.js:1906
}
// EXTERNAL MODULE: ./node_modules/core-js/modules/es7.array.includes.js
var es7_array_includes = __webpack_require__("6762");
// EXTERNAL MODULE: ./node_modules/core-js/modules/es6.string.includes.js
var es6_string_includes = __webpack_require__("2fdb");
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js
function _arrayWithoutHoles(arr) {
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
}
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArray.js
function _iterableToArray(iter) {
if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
}
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js
function _nonIterableSpread() {
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js
function _toConsumableArray(arr) {
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
}
// EXTERNAL MODULE: external {"commonjs":"sortablejs","commonjs2":"sortablejs","amd":"sortablejs","root":"Sortable"}
var external_commonjs_sortablejs_commonjs2_sortablejs_amd_sortablejs_root_Sortable_ = __webpack_require__("a352");
var external_commonjs_sortablejs_commonjs2_sortablejs_amd_sortablejs_root_Sortable_default = /*#__PURE__*/__webpack_require__.n(external_commonjs_sortablejs_commonjs2_sortablejs_amd_sortablejs_root_Sortable_);
// EXTERNAL MODULE: ./src/util/helper.js
var helper = __webpack_require__("c649");
// CONCATENATED MODULE: ./src/vuedraggable.js
View on GitHub (pinned to 4306c0717f)