{"record":{"id":"83cdb998cdd7a93e","repo":"different-ai/openwork","slug":"automation-saved-script-input-invalid","errorCode":"automation_saved_script_input_invalid","errorMessage":"automation_saved_script_input_invalid","messagePattern":"automation_saved_script_input_invalid","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"ee/apps/den-api/src/workflows.ts","lineNumber":581,"sourceCode":"    ))\n    .innerJoin(PluginConfigObjectTable, and(\n      eq(PluginConfigObjectTable.configObjectId, ConfigObjectTable.id),\n      eq(PluginConfigObjectTable.pluginId, pluginId),\n      isNull(PluginConfigObjectTable.removedAt),\n    ))\n    .where(and(\n      eq(ConfigObjectVersionTable.id, configObjectVersionId),\n      eq(ConfigObjectVersionTable.configObjectId, configObjectId),\n      eq(ConfigObjectVersionTable.organizationId, organizationId),\n      eq(ConfigObjectVersionTable.isDeletedVersion, false),\n    )).limit(1)\n  const version = rows[0]?.version\n  if (!version) throw new Error(\"automation_saved_script_version_not_found\")\n  const parsed = parseCodemodeScriptPayload(version.normalizedPayloadJson)\n  if (!parsed.ok) throw new Error(\"automation_saved_script_version_invalid\")\n  if (parsed.payload.inputSchema) {\n    const validation = validateCodemodeScriptInput(parsed.payload.inputSchema, input.action.input)\n    if (!validation.ok) throw new Error(\"automation_saved_script_input_invalid\")\n  }\n}\n\nexport async function saveWorkflow(input: {\n  organizationId: string\n  ownerMemberId: string\n  workflow: SaveWorkflowInput\n  buildTools: () => Promise<BuiltCodemodeTools>\n  context?: PluginArchActorContext\n}): Promise<{ pluginId: string; configObjectId: string; configObjectVersionId: string }> {\n  const organizationId = normalizeDenTypeId(\"organization\", input.organizationId)\n  const ownerMemberId = normalizeDenTypeId(\"member\", input.ownerMemberId)\n  const requestedPluginId = input.workflow.pluginId\n    ? normalizeDenTypeId(\"plugin\", input.workflow.pluginId)\n    : null\n  if (requestedPluginId) {\n    if (\n      !input.context","sourceCodeStart":563,"sourceCodeEnd":599,"githubUrl":"https://github.com/different-ai/openwork/blob/2b7df46e8ae1517d64c896c7793d2d52ec845669/ee/apps/den-api/src/workflows.ts#L563-L599","documentation":"Thrown in validateWorkflowAutomationAction when the saved script version declares an inputSchema and validateCodemodeScriptInput rejects the automation action's input. The stored script is fine, but the input supplied for the scheduled action does not conform to its JSON schema.","triggerScenarios":"Creating/updating an automation whose action.input is missing required properties, has wrong types, or violates constraints defined in the script version's inputSchema.","commonSituations":"Script schema updated after the automation was configured; typos in input keys; passing raw strings where the schema expects numbers/enums; editing automations in bulk against newer script versions.","solutions":["Validate action.input against the version's inputSchema (e.g. with the same Zod/JSON-schema validator) before saving the automation.","Update the automation's input to match the current inputSchema of the pinned version.","If the input is intentionally changing, publish a new script version whose inputSchema matches the desired input."],"exampleFix":"// before\naction: { configObjectVersionId, input: { since: \"last-week\" } } // schema expects number\n// after\nconst parsed = inputSchema.safeParse({ since: 7 })\nif (parsed.success) action = { configObjectVersionId, input: parsed.data }","handlingStrategy":"validation","validationCode":"const parsed = parseCodemodeScriptPayload(version.normalizedPayloadJson)\nif (parsed.ok && parsed.payload.inputSchema) {\n  const ok = validateCodemodeScriptInput(parsed.payload.inputSchema, action.input).ok\n  if (!ok) throw new Error(\"automation input does not match script inputSchema\")\n}","typeGuard":null,"tryCatchPattern":"try {\n  await updateAutomation({ action, ... })\n} catch (e) {\n  if (e.message === \"automation_saved_script_input_invalid\") {\n    // fix action.input against the version's inputSchema\n  } else throw e\n}","preventionTips":["Validate action.input with validateCodemodeScriptInput before saving.","Re-check inputs whenever the pinned script version's inputSchema changes.","Use typed forms in the UI driven by inputSchema to prevent bad inputs."],"tags":["automation","input-validation","json-schema","den-api"],"backgroundTag":"schema-validation-failed","analyzedSha":"2b7df46e8ae1517d64c896c7793d2d52ec845669","analyzedAt":"2026-09-01T07:59:23.713Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}