prisma/prisma · error

PSL_PRESET_NOT_LIST

PSL_PRESET_NOT_LIST

Error message

Field "${model.name}.${field.name}" uses a field-preset call as a list element type. Presets cannot be list elements; remove "[]" or use a scalar type.

What it means

A field is declared as a list (`[]`) whose element type is a field-preset call (e.g. `temporal.updatedAt()[]`). Field presets are complete field declarations — they carry their own codec, default, nullability, and id/unique semantics — so they cannot be composed with list-of semantics. Prisma Next rejects this at resolution time so the contract never carries an ambiguous preset-as-list-element column.

Source

Thrown at packages/2-sql/2-authoring/contract-psl/src/psl-field-resolution.ts:430

        continue;
      }
      const resolved = resolveFieldTypeDescriptor(resolveInput);
      if (!resolved.ok) {
        if (!resolved.alreadyReported) {
          diagnostics.push({
            code: 'PSL_UNSUPPORTED_FIELD_TYPE',
            message: `Field "${model.name}.${field.name}" type "${field.typeName}" is not supported in SQL PSL provider v1`,
            sourceId,
            span: field.span,
          });
        }
        continue;
      }
      // Field presets are complete declarations — they carry their own codec
      // and do not compose with `[]` list-of semantics. Reject early.
      if (resolved.presetContributions) {
        diagnostics.push({
          code: 'PSL_PRESET_NOT_LIST',
          message: `Field "${model.name}.${field.name}" uses a field-preset call as a list element type. Presets cannot be list elements; remove "[]" or use a scalar type.`,
          sourceId,
          span: field.span,
        });
        continue;
      }
      scalarCodecId = resolved.descriptor.codecId;
      descriptor = resolved.descriptor;
    } else {
      const resolved = resolveFieldTypeDescriptor(resolveInput);
      if (!resolved.ok) {
        if (!resolved.alreadyReported) {
          diagnostics.push({
            code: 'PSL_UNSUPPORTED_FIELD_TYPE',
            message: `Field "${model.name}.${field.name}" type "${field.typeName}" is not supported in SQL PSL provider v1`,
            sourceId,
            span: field.span,
          });

View on GitHub (pinned to 1243cdffbe)

Solutions

  1. Remove the `[]` from the field — presets are single-column declarations, not list element types.
  2. If you truly need a list of timestamps or ids, declare a plain scalar list (e.g. `DateTime[]`) and manage defaults per-row in application code or via a child relation.
  3. Use a type constructor (not a preset) if a list of a target-native type is required.

Example fix

// before
model Event {
  id      String @id
  stamps  temporal.updatedAt()[]
}

// after — scalar list, no preset
model Event {
  id      String     @id
  stamps  DateTime[]
}
Defensive patterns

Strategy: validation

Validate before calling

// A field preset is a registered preset-call type name (e.g. @prisma-next/...). Detect any preset call used with [] suffix.
const PRESET_CALL = /([A-Za-z_][\w.]*)\s*\(.*?\)\s*\[\]/;
function findPresetAsListElement(psl: string): { model: string; field: string }[] {
  const out: { model: string; field: string }[] = [];
  for (const m of psl.matchAll(/model\s+(\w+)\s*\{([\s\S]*?)\}/g)) {
    for (const f of m[2].matchAll(/^\s*(\w+)\s+([\s\S]+?)/m)) {
      if (PRESET_CALL.test(f[2])) out.push({ model: m[1], field: f[1] });
    }
  }
  return out;
}

Type guard

null

Try / catch

const result = await provider.load(context);
if (!result.ok) {
  const presetList = result.error.diagnostics.filter((d) => d.code === 'PSL_PRESET_NOT_LIST');
  for (const d of presetList) { /* drop the [] from the offending field's type */ }

Prevention

When it happens

Trigger: Raised in the `isListField` branch after `resolveFieldTypeDescriptor` succeeds (`resolved.ok === true`) but `resolved.presetContributions` is defined, indicating the element type resolved through the field-preset dispatch path (a descriptor was found in `authoringContributions.field`).

Common situations: Trying to apply `temporal.updatedAt()` or `id.uuidv7String()` to every element of a list field; mechanically suffixing a migrated preset field with `[]` during a Prisma-6-to-Prisma-Next port; misunderstanding presets as element-level type constructors.

Related errors


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