windmill-labs/windmill · error

Nested argument not found!

Error message

Nested argument not found!

What it means

In the schema property editor (AddProperty.svelte `handleDeleteArgument`), when deleting a nested argument the code walks `argPath` down the modified schema's `properties`. If a path segment is missing from the current schema object, the traversal cannot proceed and throws this error.

Source

Thrown at frontend/src/lib/components/schema/AddProperty.svelte:135

		if (argError !== '') {
			sendUserToast(argError, true)
		}
		dispatch('change', schema)
	}

	export function handleDeleteArgument(argPath: string[], nschema?: Schema): void {
		try {
			let modifiedObject: Schema = { ...(nschema ?? schema) }
			let modifiedProperties = modifiedObject.properties as object
			let argName = argPath.pop() as string

			argPath.forEach((property) => {
				if (Object.keys(modifiedProperties).includes(property)) {
					modifiedObject = modifiedProperties[property]
					modifiedProperties = modifiedObject.properties as object
				} else {
					throw Error('Nested argument not found!')
				}
			})

			if (Object.keys(modifiedProperties).includes(argName)) {
				delete modifiedProperties[argName]

				if (modifiedObject.required) {
					modifiedObject.required = schema.required.filter((arg) => arg !== argName)
				}
				if (modifiedObject.order) {
					modifiedObject.order = modifiedObject.order.filter((arg) => arg !== argName)
				}
				schema = modifiedObject
				schemaString = JSON.stringify(schema, null, '\t')
				dispatch('change', schema)
			} else {
				throw Error('Argument not found!')
			}

View on GitHub (pinned to e474e8803c)

Solutions

  1. Refresh the schema editor to reload the current schema, then retry the delete
  2. Check that the nested parent object still exists under the expected name
  3. Re-derive the argument path from the current schema instead of a cached one
  4. Manually edit the schema JSON to remove the property if the UI path is broken

Example fix

// guard the traversal
argPath.forEach((property) => {
  if (!modifiedProperties || !Object.keys(modifiedProperties).includes(property)) {
    console.warn('stale path, refreshing schema'); return refresh();
  }
  modifiedObject = modifiedProperties[property];
  modifiedProperties = modifiedObject.properties;
});
Defensive patterns

Strategy: type-guard

Validate before calling

// verify the full path exists before dispatching delete
let node = schema;
for (const seg of argPath) {
  if (!node?.properties?.[seg]) throw new Error(`Stale path: ${seg} missing`);
  node = node.properties[seg];
}

Type guard

function hasNestedPath(schema: any, path: string[]): boolean {
  let node = schema;
  for (const seg of path) {
    if (!node?.properties || !(seg in node.properties)) return false;
    node = node.properties[seg];
  }
  return true;
}

Try / catch

try { await handleDeleteArgument(arg); } catch (e) {
  if (/Nested argument not found/.test(String(e))) { await reloadSchema(); }
  else throw e; // toast already shown by handler
}

Prevention

When it happens

Trigger: Deleting a nested argument whose parent chain no longer matches the schema — e.g. the parent object was renamed or deleted elsewhere, the schema was edited externally, or argPath is stale relative to the current schema state.

Common situations: Concurrent edits where another tab removed the nested object, undo/redo leaving argPath pointing at a removed branch, or a schema pasted over the old one while a delete on an old path is pending.

Related errors


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