{"id":"b46c93e09885892e","repo":"prisma/prisma","slug":"psl-unsupported-field-type-b46c93","errorCode":"PSL_UNSUPPORTED_FIELD_TYPE","errorMessage":"Field \"${compositeType.name}.${field.name}\" type \"${field.typeName}\" is not supported","messagePattern":"Field \"(.+?)\\.(.+?)\" type \"(.+?)\" is not supported","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/2-sql/2-authoring/contract-psl/src/interpreter.ts","lineNumber":1517,"sourceCode":"        continue;\n      }\n      const resolved = resolveFieldTypeDescriptor({\n        field,\n        enumTypeDescriptors,\n        namedTypeDescriptors,\n        scalarColumnDescriptors,\n        authoringContributions,\n        composedExtensions,\n        familyId,\n        targetId,\n        diagnostics,\n        sourceId,\n        entityLabel: `Field \"${compositeType.name}.${field.name}\"`,\n      });\n      if (!resolved.ok) {\n        if (!resolved.alreadyReported) {\n          diagnostics.push({\n            code: 'PSL_UNSUPPORTED_FIELD_TYPE',\n            message: `Field \"${compositeType.name}.${field.name}\" type \"${field.typeName}\" is not supported`,\n            sourceId,\n            span: field.span,\n          });\n        }\n        continue;\n      }\n      const scalarField: ContractField = {\n        nullable: field.optional,\n        type: { kind: 'scalar', codecId: resolved.descriptor.codecId },\n      };\n      fields[field.name] = field.list ? { ...scalarField, many: true } : scalarField;\n    }\n    valueObjects[compositeType.name] = { fields };\n  }\n\n  return valueObjects;\n}","sourceCodeStart":1499,"sourceCodeEnd":1535,"githubUrl":"https://github.com/prisma/prisma/blob/1243cdffbec0506c595ac8fd5865fe258c336fa0/packages/2-sql/2-authoring/contract-psl/src/interpreter.ts#L1499-L1535","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Correct the type name to a scalar the target supports (e.g. String, Int, Boolean, DateTime).","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.","If the type is another composite type, ensure that composite type is declared in the same PSL document.","If the type comes from an enum, ensure the enum is declared in the schema."],"exampleFix":"// before\ntype Address {\n  coords Point\n}\n// after\ntype Address {\n  lat Float\n  lng Float\n}","handlingStrategy":"validation","validationCode":"// Pre-flight: composite-type (value object) fields must use a type the composed\n// target supports — i.e. one of the composed scalar codecs, declared enums, or\n// named types contributed by authoring contributions.\nimport type { ParsedCompositeType, ParsedField } from './schema-types';\n\nexport function findUnsupportedCompositeFieldTypes(\n  compositeTypes: readonly ParsedCompositeType[],\n  supportedScalarTypes: ReadonlySet<string>,\n  declaredEnums: ReadonlySet<string>,\n  declaredNamedTypes: ReadonlySet<string>,\n): { type: string; field: string }[] {\n  const problems: { type: string; field: string }[] = [];\n  for (const composite of compositeTypes) {\n    for (const field of composite.fields) {\n      const f: ParsedField = field;\n      const ok =\n        supportedScalarTypes.has(f.typeName) ||\n        declaredEnums.has(f.typeName) ||\n        declaredNamedTypes.has(f.typeName);\n      if (!ok) problems.push({ type: f.typeName, field: `${composite.name}.${f.name}` });\n    }\n  }\n  return problems;\n}\n\n// 'supportedScalarTypes' should come from the composed target's codec list\n// (e.g. the SQL target's scalar column descriptors), not a hardcoded list.","typeGuard":"import type { Result } from '@prisma-next/utils/result';\nimport type { Contract, ContractSourceDiagnostics, ContractSourceDiagnostic } from '@prisma-next/config/config-types';\n\nexport function isUnsupportedFieldTypeError(\n  result: Result<Contract, ContractSourceDiagnostics>,\n): result is { ok: false; failure: ContractSourceDiagnostics } {\n  return !result.ok && result.failure.diagnostics.some(\n    (d: ContractSourceDiagnostic) => d.code === 'PSL_UNSUPPORTED_FIELD_TYPE',\n  );\n}","tryCatchPattern":null,"preventionTips":["Only use scalar types that the composed target contributes as codecs; check the target's scalar column descriptors for the authoritative list.","Register custom enums/named types in authoring contributions before referencing them from a composite type.","When composing a new target, add its scalars first and reference them by the exact contributed name — a type that resolves on one target may be unsupported on another.","Run `pnpm fixtures:check` after changing composite types so unsupported-field regressions are caught early."],"tags":["psl","schema","composite-type","scalar","validation"],"analyzedSha":"1243cdffbec0506c595ac8fd5865fe258c336fa0","analyzedAt":"2026-08-01T19:42:02.087Z","schemaVersion":2}