{"record":{"id":"2df5f5bc6175cfd0","repo":"windmill-labs/windmill","slug":"nested-argument-not-found","errorCode":null,"errorMessage":"Nested argument not found!","messagePattern":"Nested argument not found!","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"frontend/src/lib/components/schema/AddProperty.svelte","lineNumber":135,"sourceCode":"\n\t\tif (argError !== '') {\n\t\t\tsendUserToast(argError, true)\n\t\t}\n\t\tdispatch('change', schema)\n\t}\n\n\texport function handleDeleteArgument(argPath: string[], nschema?: Schema): void {\n\t\ttry {\n\t\t\tlet modifiedObject: Schema = { ...(nschema ?? schema) }\n\t\t\tlet modifiedProperties = modifiedObject.properties as object\n\t\t\tlet argName = argPath.pop() as string\n\n\t\t\targPath.forEach((property) => {\n\t\t\t\tif (Object.keys(modifiedProperties).includes(property)) {\n\t\t\t\t\tmodifiedObject = modifiedProperties[property]\n\t\t\t\t\tmodifiedProperties = modifiedObject.properties as object\n\t\t\t\t} else {\n\t\t\t\t\tthrow Error('Nested argument not found!')\n\t\t\t\t}\n\t\t\t})\n\n\t\t\tif (Object.keys(modifiedProperties).includes(argName)) {\n\t\t\t\tdelete modifiedProperties[argName]\n\n\t\t\t\tif (modifiedObject.required) {\n\t\t\t\t\tmodifiedObject.required = schema.required.filter((arg) => arg !== argName)\n\t\t\t\t}\n\t\t\t\tif (modifiedObject.order) {\n\t\t\t\t\tmodifiedObject.order = modifiedObject.order.filter((arg) => arg !== argName)\n\t\t\t\t}\n\t\t\t\tschema = modifiedObject\n\t\t\t\tschemaString = JSON.stringify(schema, null, '\\t')\n\t\t\t\tdispatch('change', schema)\n\t\t\t} else {\n\t\t\t\tthrow Error('Argument not found!')\n\t\t\t}","sourceCodeStart":117,"sourceCodeEnd":153,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/frontend/src/lib/components/schema/AddProperty.svelte#L117-L153","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Refresh the schema editor to reload the current schema, then retry the delete","Check that the nested parent object still exists under the expected name","Re-derive the argument path from the current schema instead of a cached one","Manually edit the schema JSON to remove the property if the UI path is broken"],"exampleFix":"// guard the traversal\nargPath.forEach((property) => {\n  if (!modifiedProperties || !Object.keys(modifiedProperties).includes(property)) {\n    console.warn('stale path, refreshing schema'); return refresh();\n  }\n  modifiedObject = modifiedProperties[property];\n  modifiedProperties = modifiedObject.properties;\n});","handlingStrategy":"type-guard","validationCode":"// verify the full path exists before dispatching delete\nlet node = schema;\nfor (const seg of argPath) {\n  if (!node?.properties?.[seg]) throw new Error(`Stale path: ${seg} missing`);\n  node = node.properties[seg];\n}","typeGuard":"function hasNestedPath(schema: any, path: string[]): boolean {\n  let node = schema;\n  for (const seg of path) {\n    if (!node?.properties || !(seg in node.properties)) return false;\n    node = node.properties[seg];\n  }\n  return true;\n}","tryCatchPattern":"try { await handleDeleteArgument(arg); } catch (e) {\n  if (/Nested argument not found/.test(String(e))) { await reloadSchema(); }\n  else throw e; // toast already shown by handler\n}","preventionTips":["Refresh the editor before editing schemas changed elsewhere","Re-derive argPath from the current UI selection, not cached state","Avoid concurrent edits to the same schema from multiple tabs"],"tags":["schema","ui","state-mismatch"],"backgroundTag":"stale-schema-path","analyzedSha":"e474e8803ce2ff5c2df09a58dab51d45f5c922ca","analyzedAt":"2026-09-03T12:38:19.024Z","contentChangedAt":"2026-09-03T12:38:19.024Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}