windmill-labs/windmill · error

Invalid flow inputs schema: ${invalidProperties.join(', ')}

Error message

Invalid flow inputs schema: ${invalidProperties.join(', ')}

What it means

Before exposing a flow's inputs as a tool schema to the LLM, the copilot validates every property key against the pattern ^[a-zA-Z0-9_.-]{1,64}$ (also used by Windmill for path/name validation). Keys outside this charset or longer than 64 chars are collected and thrown as 'Invalid flow inputs schema: <keys>'. This exists because downstream providers (notably Anthropic) reject tool parameter names that violate their identifier rules.

Source

Thrown at frontend/src/lib/components/copilot/chat/shared.ts:1453

			}
		}
	}
}

export async function buildSchemaForTool(
	toolDef: ChatCompletionFunctionTool,
	schemaBuilder: () => Promise<FunctionParameters>
): Promise<boolean> {
	try {
		const schema = await schemaBuilder()

		// if schema properties contains values different from '^[a-zA-Z0-9_.-]{1,64}$'
		const invalidProperties = Object.keys(schema.properties ?? {}).filter(
			(key) => !/^[a-zA-Z0-9_.-]{1,64}$/.test(key)
		)
		if (invalidProperties.length > 0) {
			console.warn(`Invalid flow inputs schema: ${invalidProperties.join(', ')}`)
			throw new Error(`Invalid flow inputs schema: ${invalidProperties.join(', ')}`)
		}

		// Anthropic requires input_schema.type to be present; flows with no inputs
		// can produce a sparse schema (e.g. { order: [] }) lacking it.
		toolDef.function.parameters = { type: 'object', ...schema, additionalProperties: false }

		// recursively normalize provider-incompatible schema fragments
		normalizeToolParameterSchema(toolDef.function.parameters)

		// OPEN AI models don't support strict mode well with schema with complex properties, so we disable it
		const model = getCurrentModel()
		if (
			model.provider === 'openai' ||
			model.provider === 'azure_openai' ||
			model.provider === 'azure_foundry'
		) {
			toolDef.function.strict = false
		}

View on GitHub (pinned to e474e8803c)

Solutions

  1. Rename the offending input keys in the flow's args schema to match ^[a-zA-Z0-9_.-]{1,64}$ (letters, digits, underscore, dot, hyphen).
  2. Shorten any key longer than 64 characters.
  3. Regenerate the flow inputs from the flow editor so keys are normalized automatically.
  4. If the key cannot change, wrap the value under a compliant parent key and reference it accordingly.

Example fix

// before (args.json)
{"properties": {"user name": {"type": "string"}}}
// after
{"properties": {"user_name": {"type": "string"}}}
Defensive patterns

Strategy: validation

Validate before calling

const KEY_RE = /^[a-zA-Z0-9_.-]{1,64}$/
const invalid = Object.keys(flowSchema.properties ?? {}).filter((k) => !KEY_RE.test(k))
if (invalid.length) throw new Error(`Fix flow input keys before chat: ${invalid.join(', ')}`)

Type guard

function hasValidInputKeys(schema: { properties?: Record<string, unknown> }): boolean {
  return Object.keys(schema.properties ?? {}).every((k) => /^[a-zA-Z0-9_.-]{1,64}$/.test(k))
}

Try / catch

try {
  const def = buildFlowInputsTool(schema)
} catch (e) {
  if (e.message.startsWith('Invalid flow inputs schema:')) {
    const fixed = sanitizeKeys(schema) // slugify keys to [a-zA-Z0-9_.-]
    def = buildFlowInputsTool(fixed)
  }
}

Prevention

When it happens

Trigger: A flow whose inputs (args.json / OpenAPI-style schema) contains a property key with illegal characters — spaces, unicode, special symbols, empty string — or a key longer than 64 characters, when the chat builds the flow-inputs tool definition (shared.ts:1453).

Common situations: Flow inputs were hand-edited and a key like 'my input' or 'user@email' was used; a flow imported from elsewhere has keys with slashes or dots beyond the allowed pattern; a very long descriptive key exceeding 64 chars; non-ASCII localized key names.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


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