different-ai/openwork · error

automation_saved_script_input_invalid

automation_saved_script_input_invalid

Error message

automation_saved_script_input_invalid

What it means

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.

Source

Thrown at ee/apps/den-api/src/workflows.ts:581

    ))
    .innerJoin(PluginConfigObjectTable, and(
      eq(PluginConfigObjectTable.configObjectId, ConfigObjectTable.id),
      eq(PluginConfigObjectTable.pluginId, pluginId),
      isNull(PluginConfigObjectTable.removedAt),
    ))
    .where(and(
      eq(ConfigObjectVersionTable.id, configObjectVersionId),
      eq(ConfigObjectVersionTable.configObjectId, configObjectId),
      eq(ConfigObjectVersionTable.organizationId, organizationId),
      eq(ConfigObjectVersionTable.isDeletedVersion, false),
    )).limit(1)
  const version = rows[0]?.version
  if (!version) throw new Error("automation_saved_script_version_not_found")
  const parsed = parseCodemodeScriptPayload(version.normalizedPayloadJson)
  if (!parsed.ok) throw new Error("automation_saved_script_version_invalid")
  if (parsed.payload.inputSchema) {
    const validation = validateCodemodeScriptInput(parsed.payload.inputSchema, input.action.input)
    if (!validation.ok) throw new Error("automation_saved_script_input_invalid")
  }
}

export async function saveWorkflow(input: {
  organizationId: string
  ownerMemberId: string
  workflow: SaveWorkflowInput
  buildTools: () => Promise<BuiltCodemodeTools>
  context?: PluginArchActorContext
}): Promise<{ pluginId: string; configObjectId: string; configObjectVersionId: string }> {
  const organizationId = normalizeDenTypeId("organization", input.organizationId)
  const ownerMemberId = normalizeDenTypeId("member", input.ownerMemberId)
  const requestedPluginId = input.workflow.pluginId
    ? normalizeDenTypeId("plugin", input.workflow.pluginId)
    : null
  if (requestedPluginId) {
    if (
      !input.context

View on GitHub (pinned to 2b7df46e8a)

Solutions

  1. Validate action.input against the version's inputSchema (e.g. with the same Zod/JSON-schema validator) before saving the automation.
  2. Update the automation's input to match the current inputSchema of the pinned version.
  3. If the input is intentionally changing, publish a new script version whose inputSchema matches the desired input.

Example fix

// before
action: { configObjectVersionId, input: { since: "last-week" } } // schema expects number
// after
const parsed = inputSchema.safeParse({ since: 7 })
if (parsed.success) action = { configObjectVersionId, input: parsed.data }
Defensive patterns

Strategy: validation

Validate before calling

const parsed = parseCodemodeScriptPayload(version.normalizedPayloadJson)
if (parsed.ok && parsed.payload.inputSchema) {
  const ok = validateCodemodeScriptInput(parsed.payload.inputSchema, action.input).ok
  if (!ok) throw new Error("automation input does not match script inputSchema")
}

Try / catch

try {
  await updateAutomation({ action, ... })
} catch (e) {
  if (e.message === "automation_saved_script_input_invalid") {
    // fix action.input against the version's inputSchema
  } else throw e
}

Prevention

When it happens

Trigger: Creating/updating an automation whose action.input is missing required properties, has wrong types, or violates constraints defined in the script version's inputSchema.

Common situations: 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.

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 different-ai/openwork@2b7df46e8a (2026-09-01). Data as JSON: /api/errors/83cdb998cdd7a93e. Report an issue: GitHub.