windmill-labs/windmill · error · Error

${inferedSchema.error}

Error message

${inferedSchema.error}

What it means

inferArgs infers a script's argument schema from its code using language-specific parsers (e.g. WASM/Python/DBT parsers). When a parser returns a signature object with type 'Invalid', the parser's `error` field is thrown verbatim. It means the static analyzer could not parse the code's signature for that language — usually a syntax issue or an unsupported construct, or the WASM parser itself failed.

Source

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

		} else if (language == 'rlang') {
			try {
				await initWasmR()
				inferedSchema = JSON.parse(parse_r(code))
			} catch {
				inferedSchema = parseRSignatureFallback(code)
			}
		} else if (language == 'dbt') {
			// Absent on a parser package predating dbt: the editor keeps whatever
			// schema it has rather than clearing the run form to nothing.
			if (!parse_dbt) return null
			await initWasmYaml()
			inferedSchema = JSON.parse(parse_dbt(code))
			// for related places search: ADD_NEW_LANG
		} else {
			return null
		}
		if (inferedSchema.type == 'Invalid') {
			throw new Error(inferedSchema.error)
		}
		loadSchemaLastRun.set([code, inferedSchema, mainOverride, language])
	}

	schema.required = []
	const oldProperties = JSON.parse(JSON.stringify(schema.properties))
	schema.properties = {}
	for (const arg of inferedSchema.args) {
		if (!(arg.name in oldProperties)) {
			schema.properties[arg.name] = { description: '', type: '' }
		} else {
			schema.properties[arg.name] = oldProperties[arg.name]
			if (schema.properties[arg.name].oneOf && !('oneof' in arg))
				delete schema.properties[arg.name].oneOf
		}
		schema.properties[arg.name] = sortObject(schema.properties[arg.name])

		argSigToJsonSchemaType(arg.typ, schema.properties[arg.name])

View on GitHub (pinned to e474e8803c)

Solutions

  1. Read the embedded error in the message — it names the parser's specific complaint.
  2. Fix the code syntax/construct the parser rejects (often visible as a syntax error).
  3. For dbt scripts, validate the model's YAML/config is well-formed.
  4. Define the args schema manually in the editor if the parser can't infer it.
  5. Reload the page / update the parser WASM if the error looks like a parser bug rather than bad code.

Example fix

// before: unparseable signature
def main(a, b=,)  # syntax error -> parser returns type Invalid
// after
def main(a: int, b: str = 'x')
Defensive patterns

Strategy: try-catch

Validate before calling

// check syntax with the runtime before inferring
if (language === 'python') await pyodide.runPythonAsync(`compile(open('m.py').read(), 'm', 'exec')`) // throws on syntax errors

Type guard

function isInferenceValid(s: { type?: string; error?: string }): s is { type: string } & Record<string, unknown> {
  return s.type !== 'Invalid' && !s.error
}

Try / catch

try {
  await inferArgs(language, code, parentAwareCode)
} catch (e) {
  // fall back to manual schema editing; keep last valid schema
  showManualSchemaEditor(lastValidSchema)
}

Prevention

When it happens

Trigger: Any caller (SCRIPT_SPEC, loadSchema*, inferSchemaIfNecessary, replaceScript) saving/loading a script whose code fails the language parser: e.g. dbt YAML that doesn't parse into a valid schema (parse_dbt returning type Invalid with an error), Python with unsupported signature constructs, or parser crashes surfaced as Invalid.

Common situations: Malformed dbt model config; Python code using constructs the signature parser doesn't support (e.g. *args/**kwargs in unexpected places, decorators confusing the parser); stale WASM parser module; code edited outside the editor introducing syntax errors.

Related errors


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