{"record":{"id":"b7f7eb66cff30d0b","repo":"windmill-labs/windmill","slug":"invalid-result","errorCode":null,"errorMessage":"Invalid result","messagePattern":"Invalid result","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"frontend/src/lib/components/apps/editor/settingsPanel/ComponentPanelDataSource.svelte","lineNumber":328,"sourceCode":"\t): string {\n\t\treturn `\\t{\n\\t\\t\"type\": \"${dataset.type}\",\n\\t\\t\"x\": ${xDataExpr},\n\\t\\t\"y\": ${resolveConfiguration(dataset.value, connections)},\n\\t\\t\"text\": \"${dataset.tooltip || ''}\",\n\\t\\t\"aggregation_method\": \"${dataset.aggregation_method}\",\n\\t\\t\"marker\": {\n\\t\\t\\t\"color\": \"${dataset.color}\"\n\\t\\t}\n\\t}`\n\t}\n\n\tfunction datasetToAgChartJson(): string {\n\t\tconst outputs = $worldStore.outputsById[component.id]\n\t\tconst result = outputs?.result.peak()\n\n\t\tif (!result.data && !result.series) {\n\t\t\tthrow new Error('Invalid result')\n\t\t}\n\n\t\treturn (\n\t\t\t'(' +\n\t\t\tJSON.stringify(\n\t\t\t\t{\n\t\t\t\t\tdata: result.data,\n\t\t\t\t\tseries: result.series\n\t\t\t\t},\n\t\t\t\tnull,\n\t\t\t\t'\\t'\n\t\t\t) +\n\t\t\t')'\n\t\t)\n\t}\n</script>\n\n{#if component.type === 'plotlycomponentv2' || component.type === 'chartjscomponentv2'}","sourceCodeStart":310,"sourceCodeEnd":346,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/frontend/src/lib/components/apps/editor/settingsPanel/ComponentPanelDataSource.svelte#L310-L346","documentation":"datasetToAgChartJson() in ComponentPanelDataSource.svelte converts the selected component's run result into AG Chart JSON. It requires the result to expose .data or .series; otherwise it throws 'Invalid result'.","triggerScenarios":"Opening/generating chart data for a component whose worldStore outputsById[component.id].result has neither a 'data' nor a 'series' key (peak() returns undefined or an unrelated shape).","commonSituations":"The component (e.g. a script step feeding a chart) was never run in preview, so outputs are empty; the step returns a flat scalar instead of an array/dataset; the wrong component is selected in the data-source panel.","solutions":["Run the component/flow in preview so outputs exist, then retry","Make the feeding step return an object with 'data' or 'series' keys (e.g. an array of rows under data)","Verify you selected the component that actually produces the dataset"],"exampleFix":"// before\nresult: {status: 'ok'} // no data/series\n// after\nresult: {data: [{x: 1, y: 2}]}","handlingStrategy":"validation","validationCode":"const result = $worldStore.outputsById[component.id]?.result.peak()\nif (!result || (!result.data && !result.series)) {\n  // run the component in preview first, or supply default data\n}","typeGuard":"function hasChartData(r: unknown): r is {data?: unknown; series?: unknown} {\n  return !!r && typeof r === 'object' && ('data' in r || 'series' in r)\n}","tryCatchPattern":"try {\n  const json = datasetToAgChartJson()\n} catch (e) {\n  if (e.message === 'Invalid result') {\n    console.warn('Run the component in preview to produce data/series before charting')\n  } else throw e\n}","preventionTips":["Always run a preview before opening the chart data-source panel","Make feeding steps return objects with data/series keys","Confirm the selected component is the dataset producer"],"tags":["windmill-apps","ag-chart","missing-data"],"backgroundTag":"empty-step-output","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"}