{"record":{"id":"72fc73a1cf4bef85","repo":"different-ai/openwork","slug":"workflow-current-input-invalid","errorCode":"workflow_current_input_invalid","errorMessage":"workflow_current_input_invalid","messagePattern":"workflow_current_input_invalid","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"ee/apps/den-api/src/workflows.ts","lineNumber":373,"sourceCode":"  return {\n    ...execution,\n    finishedAt: new Date().toISOString(),\n    requiredCapabilities: payload.parsed.requiredCapabilities,\n  }\n}\n\nexport async function createWorkflowVersion(input: {\n  context: PluginArchActorContext\n  configObjectId: string\n  receiptId: string\n  draft: WorkflowDraft\n  buildTools: () => Promise<BuiltCodemodeTools>\n}) {\n  const resource = await workflowResource(input.context, input.configObjectId, \"manager\")\n  const payload = normalizedPayload(input.draft)\n  if (payload.parsed.inputSchema) {\n    const validation = validateCodemodeScriptInput(payload.parsed.inputSchema, input.draft.exampleInput)\n    if (!validation.ok) throw new Error(\"workflow_current_input_invalid\")\n  }\n  const codeDigest = codemodeCodeDigest(input.draft.code)\n  const scriptInputDigest = artifactDigest(input.draft.exampleInput ?? null)\n  const inputSchemaDigest = optionalArtifactDigest(payload.parsed.inputSchema)\n  const outputSchemaDigest = optionalArtifactDigest(payload.parsed.outputSchema)\n  const receipts = await db.select().from(WorkflowRunTable).where(and(\n    eq(WorkflowRunTable.id, parseReceiptId(input.receiptId)),\n    eq(WorkflowRunTable.organization_id, resource.configObject.organizationId),\n    eq(WorkflowRunTable.org_membership_id, input.context.organizationContext.currentMember.id),\n    eq(WorkflowRunTable.plugin_id, resource.plugin.id),\n    eq(WorkflowRunTable.config_object_id, resource.configObject.id),\n    isNull(WorkflowRunTable.config_object_version_id),\n    eq(WorkflowRunTable.source, draftReceiptSource(resource.configObject.id, input.draft)),\n    eq(WorkflowRunTable.code_digest, codeDigest),\n    eq(WorkflowRunTable.script_input_digest, scriptInputDigest),\n    inputSchemaDigest === null\n      ? isNull(WorkflowRunTable.input_schema_digest)\n      : eq(WorkflowRunTable.input_schema_digest, inputSchemaDigest),","sourceCodeStart":355,"sourceCodeEnd":391,"githubUrl":"https://github.com/different-ai/openwork/blob/2b7df46e8ae1517d64c896c7793d2d52ec845669/ee/apps/den-api/src/workflows.ts#L355-L391","documentation":"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.","triggerScenarios":"Calling createWorkflowVersion with a draft whose inputSchema parses, but whose exampleInput violates the schema (missing required fields, wrong types, extra constraints).","commonSituations":"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.","solutions":["Update draft.exampleInput so it satisfies the declared inputSchema","If the schema change was unintentional, revert the inputSchema in the draft","Run the same validation locally before submitting the draft to see the field-level failures"],"exampleFix":"// before\n{ inputSchema: { type: 'object', required: ['region'] }, exampleInput: {} }\n// after\n{ inputSchema: { type: 'object', required: ['region'] }, exampleInput: { region: 'us-east-1' } }","handlingStrategy":"validation","validationCode":"const parsed = inputSchema.safeParse(exampleInput)\nif (!parsed.success) {\n  throw new Error(`exampleInput violates inputSchema: ${parsed.error.issues.map((i) => `${i.path.join('.')}: ${i.message}`).join('; ')}`)\n}","typeGuard":"function exampleInputMatches(schema: ZodType, example: unknown): example is unknown {\n  return schema.safeParse(example).success\n}","tryCatchPattern":"try {\n  await createWorkflowVersion(ctx, draft)\n} catch (e) {\n  if (e instanceof Error && e.message === 'workflow_current_input_invalid') {\n    // surface schema-vs-example mismatch with field details\n  } else throw e\n}","preventionTips":["Regenerate exampleInput whenever the inputSchema changes in a draft","Validate the example against the schema client-side before submitting the version","Keep examples as executable fixtures updated alongside schema edits"],"tags":["workflow","validation","schema","input"],"backgroundTag":"input-schema-validation-failed","analyzedSha":"2b7df46e8ae1517d64c896c7793d2d52ec845669","analyzedAt":"2026-09-01T07:59:23.713Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}