prisma/prisma · error

PSL_UNSUPPORTED_FIELD_TYPE

PSL_UNSUPPORTED_FIELD_TYPE

Error message

Field "${compositeType.name}.${field.name}" type "${field.typeName}" is not supported

What it means

While lowering composite types (PSL `type` blocks) into contract value objects, each field's type is resolved via `resolveFieldTypeDescriptor`. If resolution fails and the failure was not already reported elsewhere (`alreadyReported`), this diagnostic is emitted (interpreter.ts:1515). It means the field type is neither another composite type, a known scalar with a codec, an enum, nor a registered named type contributed by a target pack.

Source

Thrown at packages/2-sql/2-authoring/contract-psl/src/interpreter.ts:1517

        continue;
      }
      const resolved = resolveFieldTypeDescriptor({
        field,
        enumTypeDescriptors,
        namedTypeDescriptors,
        scalarColumnDescriptors,
        authoringContributions,
        composedExtensions,
        familyId,
        targetId,
        diagnostics,
        sourceId,
        entityLabel: `Field "${compositeType.name}.${field.name}"`,
      });
      if (!resolved.ok) {
        if (!resolved.alreadyReported) {
          diagnostics.push({
            code: 'PSL_UNSUPPORTED_FIELD_TYPE',
            message: `Field "${compositeType.name}.${field.name}" type "${field.typeName}" is not supported`,
            sourceId,
            span: field.span,
          });
        }
        continue;
      }
      const scalarField: ContractField = {
        nullable: field.optional,
        type: { kind: 'scalar', codecId: resolved.descriptor.codecId },
      };
      fields[field.name] = field.list ? { ...scalarField, many: true } : scalarField;
    }
    valueObjects[compositeType.name] = { fields };
  }

  return valueObjects;
}

View on GitHub (pinned to 1243cdffbe)

Solutions

  1. Correct the type name to a scalar the target supports (e.g. String, Int, Boolean, DateTime).
  2. If the type is custom, register a scalar column descriptor / codec for it through the target pack's authoring contributions and compose that pack into the target.
  3. If the type is another composite type, ensure that composite type is declared in the same PSL document.
  4. If the type comes from an enum, ensure the enum is declared in the schema.

Example fix

// before
type Address {
  coords Point
}
// after
type Address {
  lat Float
  lng Float
}
Defensive patterns

Strategy: validation

Validate before calling

// Pre-flight: composite-type (value object) fields must use a type the composed
// target supports — i.e. one of the composed scalar codecs, declared enums, or
// named types contributed by authoring contributions.
import type { ParsedCompositeType, ParsedField } from './schema-types';

export function findUnsupportedCompositeFieldTypes(
  compositeTypes: readonly ParsedCompositeType[],
  supportedScalarTypes: ReadonlySet<string>,
  declaredEnums: ReadonlySet<string>,
  declaredNamedTypes: ReadonlySet<string>,
): { type: string; field: string }[] {
  const problems: { type: string; field: string }[] = [];
  for (const composite of compositeTypes) {
    for (const field of composite.fields) {
      const f: ParsedField = field;
      const ok =
        supportedScalarTypes.has(f.typeName) ||
        declaredEnums.has(f.typeName) ||
        declaredNamedTypes.has(f.typeName);
      if (!ok) problems.push({ type: f.typeName, field: `${composite.name}.${f.name}` });
    }
  }
  return problems;
}

// 'supportedScalarTypes' should come from the composed target's codec list
// (e.g. the SQL target's scalar column descriptors), not a hardcoded list.

Type guard

import type { Result } from '@prisma-next/utils/result';
import type { Contract, ContractSourceDiagnostics, ContractSourceDiagnostic } from '@prisma-next/config/config-types';

export function isUnsupportedFieldTypeError(
  result: Result<Contract, ContractSourceDiagnostics>,
): result is { ok: false; failure: ContractSourceDiagnostics } {
  return !result.ok && result.failure.diagnostics.some(
    (d: ContractSourceDiagnostic) => d.code === 'PSL_UNSUPPORTED_FIELD_TYPE',
  );
}

Prevention

When it happens

Trigger: Declaring `type Address { coords Point }` where `Point` is not a registered scalar/codec, enum, or named type for the current target; using a type name contributed by an extension pack that was not composed into the family/target; a typo in a scalar name.

Common situations: Using a database-native type (e.g. `geometry`, `citext`) without composing the target pack that registers its codec; referencing a type that exists only in a different family; upgrading the schema before registering a custom scalar descriptor.

Related errors


AI-assisted analysis of prisma/prisma@1243cdffbe (2026-08-01). Data as JSON: /data/errors/b46c93e09885892e.json. Report an issue: GitHub.