different-ai/openwork · error

workflow_current_input_invalid

workflow_current_input_invalid

Error message

workflow_current_input_invalid

What it means

When creating a new workflow version, if the draft declares an inputSchema, the provided exampleInput is validated against that schema via validateCodemodeScriptInput. A failing validation aborts version creation with this Error, ensuring every stored version has a testable, schema-conformant example input.

Source

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

  return {
    ...execution,
    finishedAt: new Date().toISOString(),
    requiredCapabilities: payload.parsed.requiredCapabilities,
  }
}

export async function createWorkflowVersion(input: {
  context: PluginArchActorContext
  configObjectId: string
  receiptId: string
  draft: WorkflowDraft
  buildTools: () => Promise<BuiltCodemodeTools>
}) {
  const resource = await workflowResource(input.context, input.configObjectId, "manager")
  const payload = normalizedPayload(input.draft)
  if (payload.parsed.inputSchema) {
    const validation = validateCodemodeScriptInput(payload.parsed.inputSchema, input.draft.exampleInput)
    if (!validation.ok) throw new Error("workflow_current_input_invalid")
  }
  const codeDigest = codemodeCodeDigest(input.draft.code)
  const scriptInputDigest = artifactDigest(input.draft.exampleInput ?? null)
  const inputSchemaDigest = optionalArtifactDigest(payload.parsed.inputSchema)
  const outputSchemaDigest = optionalArtifactDigest(payload.parsed.outputSchema)
  const receipts = await db.select().from(WorkflowRunTable).where(and(
    eq(WorkflowRunTable.id, parseReceiptId(input.receiptId)),
    eq(WorkflowRunTable.organization_id, resource.configObject.organizationId),
    eq(WorkflowRunTable.org_membership_id, input.context.organizationContext.currentMember.id),
    eq(WorkflowRunTable.plugin_id, resource.plugin.id),
    eq(WorkflowRunTable.config_object_id, resource.configObject.id),
    isNull(WorkflowRunTable.config_object_version_id),
    eq(WorkflowRunTable.source, draftReceiptSource(resource.configObject.id, input.draft)),
    eq(WorkflowRunTable.code_digest, codeDigest),
    eq(WorkflowRunTable.script_input_digest, scriptInputDigest),
    inputSchemaDigest === null
      ? isNull(WorkflowRunTable.input_schema_digest)
      : eq(WorkflowRunTable.input_schema_digest, inputSchemaDigest),

View on GitHub (pinned to 2b7df46e8a)

Solutions

  1. Update draft.exampleInput so it satisfies the declared inputSchema
  2. If the schema change was unintentional, revert the inputSchema in the draft
  3. Run the same validation locally before submitting the draft to see the field-level failures

Example fix

// before
{ inputSchema: { type: 'object', required: ['region'] }, exampleInput: {} }
// after
{ inputSchema: { type: 'object', required: ['region'] }, exampleInput: { region: 'us-east-1' } }
Defensive patterns

Strategy: validation

Validate before calling

const parsed = inputSchema.safeParse(exampleInput)
if (!parsed.success) {
  throw new Error(`exampleInput violates inputSchema: ${parsed.error.issues.map((i) => `${i.path.join('.')}: ${i.message}`).join('; ')}`)
}

Type guard

function exampleInputMatches(schema: ZodType, example: unknown): example is unknown {
  return schema.safeParse(example).success
}

Try / catch

try {
  await createWorkflowVersion(ctx, draft)
} catch (e) {
  if (e instanceof Error && e.message === 'workflow_current_input_invalid') {
    // surface schema-vs-example mismatch with field details
  } else throw e
}

Prevention

When it happens

Trigger: Calling createWorkflowVersion with a draft whose inputSchema parses, but whose exampleInput violates the schema (missing required fields, wrong types, extra constraints).

Common situations: Tightening the input schema in a new draft while reusing the old example input; typos in example keys; nested object examples not matching schema shape; null exampleInput for a schema with required properties.

Related errors


AI-assisted analysis of different-ai/openwork@2b7df46e8a (2026-09-01). Data as JSON: /api/errors/72fc73a1cf4bef85. Report an issue: GitHub.