{"record":{"id":"b78836427c703b81","repo":"windmill-labs/windmill","slug":"svelte-select-loadoptions-error","errorCode":null,"errorMessage":"svelte-select loadOptions error :>> ","messagePattern":"svelte-select loadOptions error :>> ","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"frontend/src/lib/components/apps/svelte-select/lib/get-items.js","lineNumber":8,"sourceCode":"export default async function getItems({\n\tdispatch,\n\tloadOptions,\n\tconvertStringItemsToObjects,\n\tfilterText\n}) {\n\tlet res = await loadOptions(filterText).catch((err) => {\n\t\tconsole.warn('svelte-select loadOptions error :>> ', err)\n\t\tdispatch('error', { type: 'loadOptions', details: err })\n\t})\n\n\tif (res && !res.cancelled) {\n\t\tif (res) {\n\t\t\tif (res && res.length > 0 && typeof res[0] !== 'object') {\n\t\t\t\tres = convertStringItemsToObjects(res)\n\t\t\t}\n\n\t\t\tdispatch('loaded', { items: res })\n\t\t} else {\n\t\t\tres = []\n\t\t}\n\n\t\treturn {\n\t\t\tfilteredItems: res,\n\t\t\tloading: false,\n\t\t\tfocused: true,","sourceCodeStart":1,"sourceCodeEnd":26,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/frontend/src/lib/components/apps/svelte-select/lib/get-items.js#L1-L26","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Open the app editor and fix the loadOptions source (script/resource/expression) so it runs without throwing.","Listen for the dispatched 'error' event ({type:'loadOptions', details}) to surface the underlying cause in your app.","Test the referenced script independently in the Windmill script editor.","Add guards/fallbacks in the options-producing script for missing inputs."],"exampleFix":"// before: options script crashes on undefined input\nreturn items.filter(i => i.type === params.filterType);\n// after\nreturn (items ?? []).filter(i => i.type === (params?.filterType ?? 'all'));","handlingStrategy":"try-catch","validationCode":"// in the app, wrap the loadOptions callable to validate inputs first\nasync function safeLoadOptions(filterText) {\n  if (!params || !params.filterType) return []; // guard undefined inputs\n  return loadOptions(filterText);\n}","typeGuard":"null","tryCatchPattern":"select.on('error', ({ type, details }) => {\n  if (type === 'loadOptions') console.error('options source failed:', details);\n});\n// or at the source\nawait loadOptions(filterText).catch(err => {\n  console.warn('svelte-select loadOptions error :>> ', err);\n  return []; // fallback items\n});","preventionTips":["Test the options script standalone in the Windmill script editor.","Guard the options script against missing/undefined inputs.","Listen for the select's 'error' event to surface failures in dev.","Keep script paths used for options valid when renaming/moving scripts."],"tags":["frontend","apps","svelte-select","options"],"backgroundTag":"options-load-failed","analyzedSha":"e474e8803ce2ff5c2df09a58dab51d45f5c922ca","analyzedAt":"2026-09-03T12:38:19.024Z","contentChangedAt":"2026-09-03T12:38:19.024Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}