{"record":{"id":"76bf24fbbc8185f1","repo":"twentyhq/twenty","slug":"failed-to-backfill-imageidentifierfieldmetadataid-76bf24","errorCode":null,"errorMessage":"Failed to backfill imageIdentifierFieldMetadataId for workspace ${workspaceId}","messagePattern":"Failed to backfill imageIdentifierFieldMetadataId for workspace (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/twenty-server/src/database/commands/upgrade-version-command/2-3/2-3-workspace-command-1777920000000-backfill-image-identifier-field-metadata-id.command.ts","lineNumber":130,"sourceCode":"                  imageIdentifierFieldMetadataUniversalIdentifier:\n                    AVATAR_URL_FIELD_UNIVERSAL_IDENTIFIER,\n                },\n              ],\n            },\n          },\n          workspaceId,\n          isSystemBuild: true,\n          applicationUniversalIdentifier:\n            twentyStandardFlatApplication.universalIdentifier,\n        },\n      );\n\n    if (validateAndBuildResult.status === 'fail') {\n      this.logger.error(\n        `Failed to backfill imageIdentifierFieldMetadataId for workspace ${workspaceId}:\\n${JSON.stringify(validateAndBuildResult, null, 2)}`,\n      );\n\n      throw new Error(\n        `Failed to backfill imageIdentifierFieldMetadataId for workspace ${workspaceId}`,\n      );\n    }\n\n    this.logger.log(\n      `Backfilled imageIdentifierFieldMetadataId on workspaceMember for workspace ${workspaceId}`,\n    );\n  }\n}\n","sourceCodeStart":112,"sourceCodeEnd":140,"githubUrl":"https://github.com/twentyhq/twenty/blob/1f5dd2bbd2a8da3419c8cfd52dd545c0024df1a6/packages/twenty-server/src/database/commands/upgrade-version-command/2-3/2-3-workspace-command-1777920000000-backfill-image-identifier-field-metadata-id.command.ts#L112-L140","documentation":"Thrown by the 2.3 command that backfills imageIdentifierFieldMetadataId on the workspaceMember object. It runs the field-metadata update via validateBuildAndRunLegacyWorkspaceMigration (isSystemBuild: true); on status === 'fail' it logs the report and throws. The failure is in validating/applying the workspaceMember field update that stores the image field reference.","triggerScenarios":"The image field referenced by imageIdentifierFieldMetadataId does not exist on workspaceMember; the workspaceMember object is absent or deactivated; the referenced field id is a dangling FK (field was soft-deleted); the column already holds a value failing a uniqueness/format check.","commonSituations":"Workspace on an old release where the workspaceMember image field was never seeded or was removed; cross-version upgrade skipping the command that creates the image field; soft-deleted field metadata leaving a stale id.","solutions":["Inspect the logged JSON report for the failing field and error code.","Ensure the workspaceMember image field exists and is active (re-seed it if missing).","Clear any stale imageIdentifierFieldMetadataId value, then re-run the 2.3 command."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Confirm the image field referenced exists on workspaceMember:\nconst imageField = flatFieldMetadataMaps.byUniversalIdentifier[WORKSPACE_MEMBER_IMAGE_UI];\nif (!isDefined(imageField)) { /* seed it first */ }","typeGuard":null,"tryCatchPattern":"try {\n  await command.runOnWorkspace({ workspaceId, options });\n} catch (e) {\n  logger.error({ workspaceId, err: e.message }, 'imageIdentifierFieldMetadataId backfill failed');\n}","preventionTips":["Run the upgrade that creates the workspaceMember image field before the 2.3 backfill.","Clear stale imageIdentifierFieldMetadataId values pointing at soft-deleted fields."],"tags":["migration","upgrade-command","validate-and-build","workspace","field-metadata","workspace-member","backfill"],"backgroundTag":null,"analyzedSha":"1f5dd2bbd2a8da3419c8cfd52dd545c0024df1a6","analyzedAt":"2026-08-12T15:37:27.593Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}