twentyhq/twenty · warning · Error
Field ${fieldMetadata.name} is missing, please refresh the p
Error message
Field ${fieldMetadata.name} is missing, please refresh the page. If the problem persists, please contact support. What it means
Thrown by generateDepthRecordGqlFieldsFromFields (generateDepthRecordGqlFieldsFromFields.ts:121-126) when a field marked as a morph relation has no `morphRelations` array on its metadata. This indicates the in-memory object metadata is incomplete or stale relative to the field type. The message instructs the user to refresh, since a metadata reload typically fixes the inconsistency.
Source
Thrown at packages/twenty-front/src/modules/object-record/graphql/record-gql-fields/utils/generateDepthRecordGqlFieldsFromFields.ts:125
};
return {
...recordGqlFields,
...(depth === 1 && shouldOnlyLoadRelationIdentifiers
? { [fieldMetadata.name]: relationIdentifierSubGqlFields }
: undefined),
...(depth === 1 && !shouldOnlyLoadRelationIdentifiers
? { [fieldMetadata.name]: true }
: undefined),
...(relationType === RelationType.MANY_TO_ONE
? manyToOneGqlFields
: undefined),
};
}
if (isMorphRelation) {
if (!isDefined(fieldMetadata.morphRelations)) {
throw new Error(
`Field ${fieldMetadata.name} is missing, please refresh the page. If the problem persists, please contact support.`,
);
}
const morphGqlFields = fieldMetadata.morphRelations.map(
(morphRelation) => {
const morphTargetObjectMetadataItem = objectMetadataItems.find(
(objectMetadataItem) =>
objectMetadataItem.id === morphRelation.targetObjectMetadata.id,
);
if (!morphTargetObjectMetadataItem) {
throw new Error(
`Target object metadata item not found for ${fieldMetadata.name} (morph target ${morphRelation.targetObjectMetadata.nameSingular})`,
);
}
return {View on GitHub (pinned to 1f5dd2bbd2)
Solutions
- Refresh the page / refetch workspace metadata so morphRelations is populated.
- Call the metadata refetch hook to invalidate and reload object metadata.
- Confirm the backend returns morphRelations for the field in the metadata query.
- If persistent, check that the field's relation type and metadata item are consistent server-side.
Defensive patterns
Strategy: validation
Validate before calling
// Before generating field selections, confirm morph fields have morphRelations const safeFields = fields.filter( (f) => !isMorphRelationField(f) || isDefined(f.morphRelations), );
Type guard
const hasMorphRelations = (f: FieldMetadata): boolean => !isMorphRelation(f) || (isDefined(f.morphRelations) && f.morphRelations.length > 0);
Prevention
- Refetch workspace metadata after schema changes.
- Wait for metadata loading to complete before rendering record forms.
- Invalidate Apollo cache on metadata version changes.
- Show a loading state until metadata is fully populated.
When it happens
Trigger: Generating GraphQL field selections for a record whose metadata contains a field with isMorphRelation === true (or relationType matching morph) but fieldMetadata.morphRelations is undefined/null. Triggered when rendering or querying a record with morph-relation fields after metadata was partially loaded.
Common situations: Stale Apollo cache holding old metadata after a workspace schema change; metadata sync race during initial load; partial metadata payload from a network glitch; new morph field created but metadata not refetched in the active session.
Related errors
- Failed to create record
- Failed to merge records
- GraphQL errors: ${json.errors.map((e) => e.message).join(';
- No getAuthTokensFromSSOExchangeToken result
- No date fields for calendar
AI-assisted analysis of twentyhq/twenty@1f5dd2bbd2 (2026-08-12).
Data as JSON: /api/errors/eaea2fe4fefebeb3.
Report an issue: GitHub.