twentyhq/twenty · critical · Error

Standard application is missing workflowVersion field coreWo

Error message

Standard application is missing workflowVersion field coreWorkflowVersionId

What it means

Thrown by the 2.22 command that adds the coreWorkflowVersionId soft-ref field to workflowVersion. After confirming the workspace has a workflowVersion object but lacks the coreWorkflowVersionId field, the command looks up the standard field definition via findFlatEntityByUniversalIdentifier in the computed standard flat field metadata maps. If STANDARD_OBJECTS.workflowVersion.fields.coreWorkflowVersionId is absent from the standard definitions, the lookup returns undefined and the command throws.

Source

Thrown at packages/twenty-server/src/database/commands/upgrade-version-command/2-22/2-22-workspace-command-1784193206000-add-workflow-version-core-soft-ref-field.command.ts:93

        { workspaceId },
      );

    const { allFlatEntityMaps: standardAllFlatEntityMaps } =
      computeTwentyStandardApplicationAllFlatEntityMaps({
        now: new Date().toISOString(),
        workspaceId,
        twentyStandardApplicationId: twentyStandardFlatApplication.id,
      });

    const standardField = findFlatEntityByUniversalIdentifier<FlatFieldMetadata>(
      {
        flatEntityMaps: standardAllFlatEntityMaps.flatFieldMetadataMaps,
        universalIdentifier: CORE_WORKFLOW_VERSION_ID_FIELD_UNIVERSAL_IDENTIFIER,
      },
    );

    if (!isDefined(standardField)) {
      throw new Error(
        'Standard application is missing workflowVersion field coreWorkflowVersionId',
      );
    }

    if (isDryRun) {
      this.logger.log(
        `[DRY RUN] Would add coreWorkflowVersionId field for workspace ${workspaceId}`,
      );

      return;
    }

    const flatFieldMetadataToCreate: FlatFieldMetadata = {
      ...standardField,
      viewFieldIds: [],
      viewFieldUniversalIdentifiers: [],
    };

View on GitHub (pinned to 1f5dd2bbd2)

Solutions

  1. Verify STANDARD_OBJECTS.workflowVersion.fields.coreWorkflowVersionId exists in the installed twenty-shared package
  2. Rebuild twenty-shared: npx nx build twenty-shared
  3. Ensure twenty-server and twenty-shared are at the same release tag
  4. Run with --dryRun first to confirm the standard field resolves
Defensive patterns

Strategy: validation

Validate before calling

// Before running, verify the standard field exists in the installed definitions
import { STANDARD_OBJECTS } from 'twenty-shared/metadata';

const fieldUid = STANDARD_OBJECTS.workflowVersion?.fields?.coreWorkflowVersionId?.universalIdentifier;

if (!fieldUid) {
  throw new Error('twenty-shared does not define workflowVersion.fields.coreWorkflowVersionId — rebuild twenty-shared');
}

Type guard

import { isDefined } from 'twenty-shared/utils';

const hasStandardField = (uid: string | undefined): uid is string =>
  isDefined(uid) && uid.length > 0;

Prevention

When it happens

Trigger: Running 'upgrade:2-22:add-workflow-version-core-soft-ref-field' when twenty-shared/metadata does not define STANDARD_OBJECTS.workflowVersion.fields.coreWorkflowVersionId.universalIdentifier. Caused by version skew between twenty-server and twenty-shared, or the field was removed/renamed in a fork.

Common situations: Forked twenty-shared where workflowVersion fields were customized; running the command against an older twenty-shared build that predates the coreWorkflowVersionId field; a regression that removed the field from standard definitions.

Related errors


AI-assisted analysis of twentyhq/twenty@1f5dd2bbd2 (2026-08-12). Data as JSON: /api/errors/6ac7869ff30caa16. Report an issue: GitHub.