windmill-labs/windmill · error · Error

${outputs.error}

Error message

${outputs.error}

What it means

parseOutputs runs the `parse_outputs` analyzer on script code and parses its JSON result. If the result carries an `error` field, that error is thrown verbatim (unless ignoreError is set, in which case undefined is returned). It means the outputs analyzer failed to determine what the script returns — typically because the code is unparseable or uses return constructs the analyzer doesn't support.

Source

Thrown at frontend/src/lib/infer.ts:699

		}

		await inferArgs(script.language as SupportedLanguage, script.content, script.schema as any)
		return { schema: script.schema as any, summary: script.summary }
	}
}

export async function parseOutputs(
	code: string,
	ignoreError
): Promise<[string, string][] | undefined> {
	await initWasmTs()
	const getOutputs = await parse_outputs(code)
	const outputs = JSON.parse(getOutputs)
	if (outputs.error) {
		if (ignoreError) {
			return undefined
		}
		throw new Error(outputs.error)
	}
	return outputs.error ? [] : outputs.outputs
}

/** JS fallback parser for R main() signatures when WASM parser is unavailable. */
function parseRSignatureFallback(code: string): MainArgSignature {
	const result: MainArgSignature = {
		type: 'Valid',
		error: '',
		star_args: false,
		star_kwargs: false,
		args: [],
		has_preprocessor: null,
		auto_kind: null
	}

	const mainMatch = code.match(/\bmain\s*(?:<-|=)\s*function\s*\(([^)]*)\)/)
	if (!mainMatch) {

View on GitHub (pinned to e474e8803c)

Solutions

  1. Read the embedded error message — it states what the analyzer could not handle.
  2. Make the return statement(s) statically analyzable (explicit, simple returns).
  3. Fix any syntax errors in the script first.
  4. Declare the outputs schema manually instead of relying on inference.
  5. Pass ignoreError where outputs are optional, if you control the call, to degrade gracefully.

Example fix

// before
return { ...(cond ? {a: 1} : {b: 2}), [k]: v } // analyzer error
// after
const out: { a?: number; b?: number } = {}
if (cond) out.a = 1
else out.b = 2
return out
Defensive patterns

Strategy: try-catch

Validate before calling

// quick syntax gate before outputs inference
try { new Function(code) /* js/ts-ish smoke parse */ } catch (e) { throw new Error('fix syntax before outputs inference') }

Type guard

function hasAnalyzerError(o: { error?: string }): o is { error: string } {
  return typeof o.error === 'string' && o.error.length > 0
}

Try / catch

try {
  const outs = await outputs(code)
} catch (e) {
  console.warn('outputs inference failed:', e.message)
  return [] // or open manual outputs editor
}

Prevention

When it happens

Trigger: The `outputs()` accessor calls parseOutputs with ignoreError falsy and the analyzer returns { error } — e.g. code with syntax errors, dynamic/complex return statements the static analyzer can't resolve, or a parser/WASM failure.

Common situations: Scripts whose return values are computed dynamically (spread/conditional returns) confusing the analyzer; syntax-broken code saved anyway; unsupported language constructs in newer Python/TS versions; the analyzer WASM failing to load.

Related errors


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