n8n-io/n8n · error · TypeORMError

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

Error message

Column ${column.propertyName} of Entity ${entityMetadata.name} does not support length property.

What it means

Thrown by EntityMetadataValidator.validate when a column has a length set (column.length truthy) but its normalized type is not in driver.withLengthColumnTypes. Length applies only to a known subset of types (e.g. varchar, varbinary); attaching length to a type that does not honor it is rejected.

Source

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

					`Entities ${entityMetadata.name} and ${sameDiscriminatorValueEntityMetadata.name} have the same discriminator values. Make sure they are different while using the @ChildEntity decorator.`,
				);
		}

		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.`,
				);

View on GitHub (pinned to 5ac6606e81)

Solutions

  1. Remove the length option from the column, or change the column type to one that supports length (varchar, char, varbinary).
  2. Consult driver.withLengthColumnTypes for your database before setting length.
  3. Use precision/scale for decimals rather than length.

Example fix

// before
@Column({ type: 'int', length: 11 }) count: number;

// after
@Column({ type: 'int' }) count: number;
Defensive patterns

Strategy: validation

Validate before calling

function assertNoInvalidLengths(dataSource: DataSource): string[] {
  const withLength = new Set(dataSource.driver.withLengthColumnTypes as string[]);
  const problems: string[] = [];
  for (const meta of dataSource.entityMetadatas) {
    for (const col of meta.columns.filter((c) => !c.isVirtualProperty)) {
      if (col.length && !withLength.has(dataSource.driver.normalizeType(col) as string)) {
        problems.push(`${meta.targetName}.${col.propertyName} declares length but its type does not accept it`);
      }
    }
  }
  return problems;
}

Try / catch

try {
  await dataSource.initialize();
} catch (err) {
  if (err.message.includes('does not support length property')) {
    // drop the length option or change the column type
  }
  throw err;
}

Prevention

When it happens

Trigger: Setting { length: 255 } on a column whose type does not appear in withLengthColumnTypes for the active driver (e.g. boolean, integer, text, json).

Common situations: Copy-pasting a varchar column options object onto a non-length type; misunderstanding which types accept length on a given driver; migrating from MySQL (where int length is silently accepted) to postgres (where it is not).

Related errors


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