windmill-labs/windmill · warning

svelte-select loadOptions error :>>

Error message

svelte-select loadOptions error :>> 

What it means

In the Windmill app editor's svelte-select integration, getItems awaits the component's loadOptions(filterText) function; if that promise rejects (e.g. the underlying callable computing options throws or rejects), it logs this console warning and dispatches an 'error' event so the app component can react — the select simply gets no items.

Source

Thrown at frontend/src/lib/components/apps/svelte-select/lib/get-items.js:8

export default async function getItems({
	dispatch,
	loadOptions,
	convertStringItemsToObjects,
	filterText
}) {
	let res = await loadOptions(filterText).catch((err) => {
		console.warn('svelte-select loadOptions error :>> ', err)
		dispatch('error', { type: 'loadOptions', details: err })
	})

	if (res && !res.cancelled) {
		if (res) {
			if (res && res.length > 0 && typeof res[0] !== 'object') {
				res = convertStringItemsToObjects(res)
			}

			dispatch('loaded', { items: res })
		} else {
			res = []
		}

		return {
			filteredItems: res,
			loading: false,
			focused: true,

View on GitHub (pinned to e474e8803c)

Solutions

  1. Open the app editor and fix the loadOptions source (script/resource/expression) so it runs without throwing.
  2. Listen for the dispatched 'error' event ({type:'loadOptions', details}) to surface the underlying cause in your app.
  3. Test the referenced script independently in the Windmill script editor.
  4. Add guards/fallbacks in the options-producing script for missing inputs.

Example fix

// before: options script crashes on undefined input
return items.filter(i => i.type === params.filterType);
// after
return (items ?? []).filter(i => i.type === (params?.filterType ?? 'all'));
Defensive patterns

Strategy: try-catch

Validate before calling

// in the app, wrap the loadOptions callable to validate inputs first
async function safeLoadOptions(filterText) {
  if (!params || !params.filterType) return []; // guard undefined inputs
  return loadOptions(filterText);
}

Type guard

null

Try / catch

select.on('error', ({ type, details }) => {
  if (type === 'loadOptions') console.error('options source failed:', details);
});
// or at the source
await loadOptions(filterText).catch(err => {
  console.warn('svelte-select loadOptions error :>> ', err);
  return []; // fallback items
});

Prevention

When it happens

Trigger: A svelte-select in a Windmill app is configured with an options source (resource path, script, or expression) whose evaluation throws/rejects — e.g. a script erroring at runtime, a bad resource reference, or an expression referencing missing app state.

Common situations: Typo in a script path used for options; script fails because an upstream input is undefined; app previewed before its dependency script exists; network/API error when options come from an HTTP resource.

Related errors


AI-assisted analysis of windmill-labs/windmill@e474e8803c (2026-09-03). Data as JSON: /api/errors/b78836427c703b81. Report an issue: GitHub.