error: error: duplicate key value violates unique constraint

After upgrading to v0.53 (following help steps from: https://discord.com/channels/1130383047699738754/1381926650828292096) I now see following repeating errors in the logs:
server-1 | error: error: duplicate key value violates unique constraint "IDX_UNIQUE_6d269465206d2f3e283ce479b2e"
server-1 | query failed: INSERT INTO "workspace_7p0vvem84hpqothgegpexvj81"."viewField"("fieldMetadataId", "isVisible", "size", "id", "position", "aggregateOperation", "createdAt", "upd
atedAt", "deletedAt", "viewId") VALUES ($1, $2, $3, $4, $5, DEFAULT, DEFAULT, DEFAULT, DEFAULT, $6) RETURNING "fieldMetadataId", "isVisible", "size", "id", "position", "aggregateOperati
on", "createdAt", "updatedAt", "deletedAt" -- PARAMETERS: ["da5e450b-f116-4228-8d3c-b9b76fd0bb6a",true,100,"94514f91-bad9-49e9-ab8d-30aa473c36bf",7,"09c365d1-a192-4394-af23-6c2ae74454ec
"]
server-1 | error: error: duplicate key value violates unique constraint "IDX_UNIQUE_6d269465206d2f3e283ce479b2e"
server-1 | query failed: INSERT INTO "workspace_7p0vvem84hpqothgegpexvj81"."viewField"("fieldMetadataId", "isVisible", "size", "id", "position", "aggregateOperation", "createdAt", "upd
atedAt", "deletedAt", "viewId") VALUES ($1, $2, $3, $4, $5, DEFAULT, DEFAULT, DEFAULT, DEFAULT, $6) RETURNING "fieldMetadataId", "isVisible", "size", "id", "position", "aggregateOperati
on", "createdAt", "updatedAt", "deletedAt" -- PARAMETERS: ["da5e450b-f116-4228-8d3c-b9b76fd0bb6a",true,100,"94514f91-bad9-49e9-ab8d-30aa473c36bf",7,"09c365d1-a192-4394-af23-6c2ae74454ec
"]
and users are complaining that there might be missing or disappeared data (see screenshot)
No description
25 Replies
Sebastian
SebastianOP3mo ago
how can I check if data might have been removed?
Prastoin
Prastoin3mo ago
Hello, @Guillaume does this look like your position null issue or totally out of scope ?
Sebastian
SebastianOP3mo ago
sorry, I didn't get the question
Sebastian
SebastianOP3mo ago
I think it might be that now empty records are being created (or displayed):
No description
Guillaume
Guillaume3mo ago
out of scope Did you upgrade to 53 or from 53 to 55 ?
Sebastian
SebastianOP3mo ago
I've upgraded gradually from 0.50 to 0.53 @Guillaume should I try to update to 0.55 gradually?
Prastoin
Prastoin3mo ago
Hello @Sebastian I don't think this will resolve our issue here but you can give this a try in order to put on the side any potentiel lower version usage edge cases
Sebastian
SebastianOP3mo ago
updated to 0.55, but now I'm getting this error, no matter what I select - people, companies, opportunities, etc.
No description
Prastoin
Prastoin3mo ago
Are you logged in with an admin workspace member ?
Sebastian
SebastianOP3mo ago
Yes, I have admin role
Prastoin
Prastoin3mo ago
Do you please have any more information regarding the stacktrace itself ? @Weiko could you please give this is a look when you have some free time please 🙏 ?
Sebastian
SebastianOP3mo ago
that's the problem - I don't see any errors in the logs when this happens
Weiko
Weiko3mo ago
Do you have Permissions V2 enabled in the lab?
Sebastian
SebastianOP3mo ago
I can't see this option
No description
Weiko
Weiko3mo ago
My bad, not in the lab, I meant on your workspace, but it's probably not enabled then 🤔 Can you check the admin panel and see what feature flag you have /settings/admin-panel > type your admin email address in the feature flag input
Sebastian
SebastianOP3mo ago
that's all I see if I go to /settings/admin-panel
No description
Sebastian
SebastianOP3mo ago
how can I enable perms in database? I'll connect and just updated the field
Weiko
Weiko3mo ago
Do you have access to your DB? Can you see any role attached to your user? You can check userWorkspaceRole table As for the attached role (most likely admin), do you have canReadAllObjectRecords as true? If all of that is fine, it might be due to your cache. You can try flushing it with npx nx run twenty-server:command cache:flush + restart your server container
Sebastian
SebastianOP3mo ago
I can see Admin role is attached to my user @Weiko should I run this command in server container? it asks me to install nx
docker exec -it twenty-server-1 /bin/sh
/app/packages/twenty-server $ npx nx run twenty-server:command cache:flush
Need to install the following packages:
nx@21.2.0
Ok to proceed? (y) n
docker exec -it twenty-server-1 /bin/sh
/app/packages/twenty-server $ npx nx run twenty-server:command cache:flush
Need to install the following packages:
nx@21.2.0
Ok to proceed? (y) n
Weiko
Weiko3mo ago
my bad, try yarn command:prod cache:flush
Sebastian
SebastianOP3mo ago
thanks, it helped. I can see everything. but I still get a feeling that sync from gmail doesn't work, even though it's "Importing..." and I can't see any errors in the logs. how can I check if it's syncing?
Weiko
Weiko3mo ago
Do you have a worker container running?
Sebastian
SebastianOP3mo ago
yes
Weiko
Weiko3mo ago
Can you check this https://twenty.com/developers/section/self-hosting/setup#background-jobs-for-calendar-&-messaging and see if the crons are correctly running on your side?
Sebastian
SebastianOP3mo ago
I ran: yarn command:prod cron:messaging:message-list-fetch and I've got this error
worker-1 | Exception Captured
worker-1 | undefined
worker-1 | [
worker-1 | EntityMetadataNotFoundError: No metadata for "workflowAutomatedTrigger" was found.
worker-1 | at WorkspaceDataSource.getMetadata (/app/node_modules/typeorm/data-source/DataSource.js:304:19)
worker-1 | at WorkspaceEntityManager.getRepositoryKey (/app/packages/twenty-server/dist/src/engine/twenty-orm/entity-manager/workspace-entity-manager.js:77:45)
worker-1 | at WorkspaceEntityManager.getRepository (/app/packages/twenty-server/dist/src/engine/twenty-orm/entity-manager/workspace-entity-manager.js:22:36)
worker-1 | at WorkspaceDataSource.getRepository (/app/packages/twenty-server/dist/src/engine/twenty-orm/datasource/workspace.datasource.js:25:29)
worker-1 | at TwentyORMGlobalManager.getRepositoryForWorkspace (/app/packages/twenty-server/dist/src/engine/twenty-orm/twenty-orm-global.manager.js:35:48)
worker-1 | at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
worker-1 | at async CronTriggerCronJob.handle (/app/packages/twenty-server/dist/src/modules/workflow/workflow-trigger/automated-trigger/crons/jobs/cron-trigger.cron.job.js:58:56)
worker-1 | at async descriptor.value (/app/packages/twenty-server/dist/src/engine/core-modules/cron/sentry-cron-monitor.decorator.js:60:24)
worker-1 | at async MessageQueueExplorer.invokeProcessMethods (/app/packages/twenty-server/dist/src/engine/core-modules/message-queue/message-queue.explorer.js:113:17)
worker-1 | at async MessageQueueExplorer.handleProcessor (/app/packages/twenty-server/dist/src/engine/core-modules/message-queue/message-queue.explorer.js:106:13)
worker-1 | ]
worker-1 | Exception Captured
worker-1 | undefined
worker-1 | [
worker-1 | EntityMetadataNotFoundError: No metadata for "workflowAutomatedTrigger" was found.
worker-1 | at WorkspaceDataSource.getMetadata (/app/node_modules/typeorm/data-source/DataSource.js:304:19)
worker-1 | at WorkspaceEntityManager.getRepositoryKey (/app/packages/twenty-server/dist/src/engine/twenty-orm/entity-manager/workspace-entity-manager.js:77:45)
worker-1 | at WorkspaceEntityManager.getRepository (/app/packages/twenty-server/dist/src/engine/twenty-orm/entity-manager/workspace-entity-manager.js:22:36)
worker-1 | at WorkspaceDataSource.getRepository (/app/packages/twenty-server/dist/src/engine/twenty-orm/datasource/workspace.datasource.js:25:29)
worker-1 | at TwentyORMGlobalManager.getRepositoryForWorkspace (/app/packages/twenty-server/dist/src/engine/twenty-orm/twenty-orm-global.manager.js:35:48)
worker-1 | at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
worker-1 | at async CronTriggerCronJob.handle (/app/packages/twenty-server/dist/src/modules/workflow/workflow-trigger/automated-trigger/crons/jobs/cron-trigger.cron.job.js:58:56)
worker-1 | at async descriptor.value (/app/packages/twenty-server/dist/src/engine/core-modules/cron/sentry-cron-monitor.decorator.js:60:24)
worker-1 | at async MessageQueueExplorer.invokeProcessMethods (/app/packages/twenty-server/dist/src/engine/core-modules/message-queue/message-queue.explorer.js:113:17)
worker-1 | at async MessageQueueExplorer.handleProcessor (/app/packages/twenty-server/dist/src/engine/core-modules/message-queue/message-queue.explorer.js:106:13)
worker-1 | ]
@Weiko should I ignore this error?

Did you find this page helpful?