{"record":{"id":"a32e4caff9a089a1","repo":"twentyhq/twenty","slug":"failed-to-backfill-standard-skills-for-workspace","errorCode":null,"errorMessage":"Failed to backfill standard skills for workspace ${workspaceId}","messagePattern":"Failed to backfill standard skills for workspace (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/twenty-server/src/database/commands/upgrade-version-command/1-22/1-22-workspace-command-1780000002000-backfill-standard-skills.command.ts","lineNumber":110,"sourceCode":"          allFlatEntityOperationByMetadataName: {\n            skill: {\n              flatEntityToCreate: skillsToCreate,\n              flatEntityToDelete: [],\n              flatEntityToUpdate: [],\n            },\n          },\n          workspaceId,\n          applicationUniversalIdentifier:\n            twentyStandardFlatApplication.universalIdentifier,\n        },\n      );\n\n    if (validateAndBuildResult.status === 'fail') {\n      this.logger.error(\n        `Failed to backfill standard skills:\\n${JSON.stringify(validateAndBuildResult, null, 2)}`,\n      );\n\n      throw new Error(\n        `Failed to backfill standard skills for workspace ${workspaceId}`,\n      );\n    }\n\n    this.logger.log(\n      `Successfully created ${skillsToCreate.length} standard skill(s) for workspace ${workspaceId}`,\n    );\n  }\n}\n","sourceCodeStart":92,"sourceCodeEnd":120,"githubUrl":"https://github.com/twentyhq/twenty/blob/1f5dd2bbd2a8da3419c8cfd52dd545c0024df1a6/packages/twenty-server/src/database/commands/upgrade-version-command/1-22/1-22-workspace-command-1780000002000-backfill-standard-skills.command.ts#L92-L120","documentation":"Thrown by the 1.22 workspace upgrade command when validateBuildAndRunLegacyWorkspaceMigration returns 'fail' while backfilling standard skills for a workspace. The command logs the full failure JSON then throws to stop the upgrade for that workspace.","triggerScenarios":"Running the 1.22 standard-skills backfill on a workspace whose skill metadata or referenced application flat entities are missing or malformed, causing the migration builder to reject the skillsToCreate batch.","commonSituations":"Stale workspace cache so standard skill definitions resolve to nothing; skills already partially created in a prior aborted run producing duplicates; twenty-standard-application metadata version mismatch with the installed server build.","solutions":["Read the logged validateAndBuildResult JSON for the precise rejection.","Recompute the workspace cache and retry the command for that workspace.","Run --dryRun to preview skillsToCreate and confirm none already exist.","Verify the twenty-standard flat application for the workspace matches the build's STANDARD skills constant."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Dry-run to preview skillsToCreate, and confirm the standard skills constant is non-empty for this build:\nawait workspaceCacheService.invalidate(workspaceId);\nif (STANDARD_SKILLS.length === 0) throw new Error('No standard skills defined in this build; aborting backfill');","typeGuard":null,"tryCatchPattern":"try {\n  await command.runOnWorkspace({ workspaceId, options });\n} catch (err) {\n  logger.error(`Standard skills backfill failed for workspace ${workspaceId}`, err);\n  failedWorkspaces.push(workspaceId);\n}","preventionTips":["Run --dryRun to confirm skillsToCreate is non-empty and targets missing skills.","Recompute the workspace cache before running so existing-skill detection is accurate.","Verify the build's standard skills constant matches the server version.","Isolate per-workspace failures at the runner."],"tags":["migration","workspace-upgrade","skills","backfill"],"backgroundTag":null,"analyzedSha":"1f5dd2bbd2a8da3419c8cfd52dd545c0024df1a6","analyzedAt":"2026-08-12T15:37:27.593Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}