n8n-io/n8n · error · TypeORMError

Column "${column.propertyName}" of Entity "${entityMetadata.

Error message

Column "${column.propertyName}" of Entity "${entityMetadata.name}" is defined as enum, but missing "enum" or "enumName" properties.

What it means

Thrown by EntityMetadataValidator.validate when a column has type 'enum' but neither enum (the value array) nor enumName (the named enum for schema sync) is set. TypeORM needs one of these to materialize the enum type in the database and to validate values.

Source

Thrown at packages/@n8n/typeorm/src/metadata-builder/EntityMetadataValidator.ts:120

		entityMetadata.relationCounts.forEach((relationCount) => {
			if (relationCount.relation.isManyToOne || relationCount.relation.isOneToOne)
				throw new TypeORMError(
					`Relation count can not be implemented on ManyToOne or OneToOne relations.`,
				);
		});

		entityMetadata.columns
			.filter((column) => !column.isVirtualProperty)
			.forEach((column) => {
				const normalizedColumn = driver.normalizeType(column) as ColumnType;
				if (driver.supportedDataTypes.indexOf(normalizedColumn) === -1)
					throw new DataTypeNotSupportedError(column, normalizedColumn, driver.options.type);
				if (column.length && driver.withLengthColumnTypes.indexOf(normalizedColumn) === -1)
					throw new TypeORMError(
						`Column ${column.propertyName} of Entity ${entityMetadata.name} does not support length property.`,
					);
				if (column.type === 'enum' && !column.enum && !column.enumName)
					throw new TypeORMError(
						`Column "${column.propertyName}" of Entity "${entityMetadata.name}" is defined as enum, but missing "enum" or "enumName" properties.`,
					);
			});

		// Postgres supports only STORED generated columns.
		if (driver.options.type === 'postgres') {
			const virtualColumn = entityMetadata.columns.find(
				(column) =>
					column.asExpression && (!column.generatedType || column.generatedType === 'VIRTUAL'),
			);
			if (virtualColumn)
				throw new TypeORMError(
					`Column "${virtualColumn.propertyName}" of Entity "${entityMetadata.name}" is defined as VIRTUAL, but Postgres supports only STORED generated columns.`,
				);
		}

		// check if relations are all without initialized properties
		const entityInstance = entityMetadata.create(undefined, {

View on GitHub (pinned to 5ac6606e81)

Solutions

  1. Pass the TypeScript enum object: @Column({ type: 'enum', enum: StatusEnum }).
  2. For named enums (recommended when using migrations/sync), also set enumName: 'status_enum'.
  3. If you did not mean an enum, switch the type to 'text'/'varchar' and store strings.

Example fix

// before
@Column({ type: 'enum' }) status: StatusEnum;

// after
@Column({ type: 'enum', enum: StatusEnum, enumName: 'status_enum' })
status: StatusEnum;
Defensive patterns

Strategy: validation

Validate before calling

function assertEnumColumnsConfigured(dataSource: DataSource): string[] {
  const problems: string[] = [];
  for (const meta of dataSource.entityMetadatas) {
    for (const col of meta.columns) {
      if (col.type === 'enum' && !col.enum && !col.enumName) {
        problems.push(`${meta.targetName}.${col.propertyName} is enum but missing enum/enumName`);
      }
    }
  }
  return problems;
}

Try / catch

try {
  await dataSource.initialize();
} catch (err) {
  if (err.message.includes('defined as enum, but missing')) {
    // add enum: MyEnum (and enumName) to the column options
  }
  throw err;
}

Prevention

When it happens

Trigger: Declaring @Column({ type: 'enum' }) without also passing enum: MyEnum or enumName: 'my_enum'.

Common situations: Authoring an enum column hastily; refactoring from a string column to enum and forgetting the enum reference; relying on type inference alone (which is not enough for the enum column type).

Related errors


AI-assisted analysis of n8n-io/n8n@5ac6606e81 (2026-08-12). Data as JSON: /api/errors/5e8037e5ce415436. Report an issue: GitHub.