windmill-labs/windmill · error · Error

Invalid result

Error message

Invalid result

What it means

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'.

Source

Thrown at frontend/src/lib/components/apps/editor/settingsPanel/ComponentPanelDataSource.svelte:328

	): string {
		return `\t{
\t\t"type": "${dataset.type}",
\t\t"x": ${xDataExpr},
\t\t"y": ${resolveConfiguration(dataset.value, connections)},
\t\t"text": "${dataset.tooltip || ''}",
\t\t"aggregation_method": "${dataset.aggregation_method}",
\t\t"marker": {
\t\t\t"color": "${dataset.color}"
\t\t}
\t}`
	}

	function datasetToAgChartJson(): string {
		const outputs = $worldStore.outputsById[component.id]
		const result = outputs?.result.peak()

		if (!result.data && !result.series) {
			throw new Error('Invalid result')
		}

		return (
			'(' +
			JSON.stringify(
				{
					data: result.data,
					series: result.series
				},
				null,
				'\t'
			) +
			')'
		)
	}
</script>

{#if component.type === 'plotlycomponentv2' || component.type === 'chartjscomponentv2'}

View on GitHub (pinned to e474e8803c)

Solutions

  1. Run the component/flow in preview so outputs exist, then retry
  2. Make the feeding step return an object with 'data' or 'series' keys (e.g. an array of rows under data)
  3. Verify you selected the component that actually produces the dataset

Example fix

// before
result: {status: 'ok'} // no data/series
// after
result: {data: [{x: 1, y: 2}]}
Defensive patterns

Strategy: validation

Validate before calling

const result = $worldStore.outputsById[component.id]?.result.peak()
if (!result || (!result.data && !result.series)) {
  // run the component in preview first, or supply default data
}

Type guard

function hasChartData(r: unknown): r is {data?: unknown; series?: unknown} {
  return !!r && typeof r === 'object' && ('data' in r || 'series' in r)
}

Try / catch

try {
  const json = datasetToAgChartJson()
} catch (e) {
  if (e.message === 'Invalid result') {
    console.warn('Run the component in preview to produce data/series before charting')
  } else throw e
}

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Related errors


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