{"record":{"id":"16ec52de10d90ec0","repo":"windmill-labs/windmill","slug":"datatable-migration-path-not-found-in-workspa","errorCode":null,"errorMessage":"Datatable migration ${path} not found in ${workspaceFrom}","messagePattern":"Datatable migration (.+?) not found in (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/windmill-utils-internal/src/deploy.ts","lineNumber":760,"sourceCode":"          requestBody,\n        });\n      }\n    } else if (kind === \"datatable_migration\") {\n      const { datatable, timestamp } = parseDatatableMigrationDeployPath(path);\n      const migrations = await provider.listDatatableMigrations({\n        workspace: workspaceFrom,\n      });\n      const migration = (\n        migrations as {\n          datatable: string;\n          timestamp: number;\n          name: string;\n          code_up: string;\n          code_down?: string;\n        }[]\n      ).find((m) => m.datatable === datatable && m.timestamp === timestamp);\n      if (!migration) {\n        throw new Error(\n          `Datatable migration ${path} not found in ${workspaceFrom}`\n        );\n      }\n      try {\n        await provider.upsertDatatableMigration({\n          workspace: workspaceTo,\n          datatableName: datatable,\n          requestBody: {\n            timestamp: migration.timestamp,\n            name: migration.name,\n            code_up: migration.code_up,\n            ...(migration.code_down != null\n              ? { code_down: migration.code_down }\n              : {}),\n          },\n        });\n      } catch (e) {\n        throw asMigrationsDisabledError(e, datatable);","sourceCodeStart":742,"sourceCodeEnd":778,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/cli/windmill-utils-internal/src/deploy.ts#L742-L778","documentation":"During a workspace-to-workspace deploy, deployItem looks up a datatable migration in the source workspace by (datatable, timestamp) before upserting it into the target. If no migration with that timestamp exists on the source datatable, it throws `Datatable migration <path> not found in <workspaceFrom>`. The local migration file or path references a migration that was deleted or never deployed to the source workspace.","triggerScenarios":"Calling deployItem to copy a datatable_migration whose (datatable, timestamp) pair does not exist in the source workspace — e.g. the migration was archived/deleted upstream, the timestamp in the local file differs from what is deployed, or workspaceFrom is the wrong workspace.","commonSituations":"Promoting migrations between dev→staging where dev's migration was re-scaffolded with a new timestamp; the source workspace's datatable was recreated so its migrations reset; copy-pasting migration files between projects with divergent timestamps.","solutions":["Verify the migration exists in the source workspace (`wmill` datatable migration list / API) and correct workspaceFrom if wrong","Re-push the missing migration to the source workspace first, then deploy","Regenerate the migration locally so its timestamp matches one deployed on the source","If the migration is genuinely obsolete, remove it from the deploy set"],"exampleFix":"// before\ndeployItem({ kind: \"datatable_migration\", path: \"my_table/1726012345_create_users\", workspaceFrom: \"staging\", ... })\n\n// after\n// ensure staging has it first, or point at the workspace that does:\ndeployItem({ kind: \"datatable_migration\", path: \"my_table/1726012345_create_users\", workspaceFrom: \"dev\", ... })","handlingStrategy":"validation","validationCode":"const exists = await provider.checkItemExists?.({ kind: 'datatable_migration', workspace: workspaceFrom, path })\n  ?? (await listMigrations(workspaceFrom, datatable)).some(m => m.timestamp === timestamp);\nif (!exists) throw new Error(`Migration ${path} missing in ${workspaceFrom}; deploy it there first`);","typeGuard":null,"tryCatchPattern":"const r = await deployItem({ kind: 'datatable_migration', path, workspaceFrom, workspaceTo });\nif (!r.success && r.error?.includes('not found in')) {\n  console.error(`Deploy ${path} to ${workspaceFrom} first, then retry`);\n}","preventionTips":["Promote migrations in order: dev → staging → prod, never skipping a workspace","Keep migration timestamps identical across environments (deploy, don't re-scaffold per env)","List source-workspace migrations before planning a cross-workspace deploy"],"tags":["datatable","deploy","workspace-sync"],"backgroundTag":"resource-not-found-in-workspace","analyzedSha":"e474e8803ce2ff5c2df09a58dab51d45f5c922ca","analyzedAt":"2026-09-03T12:38:19.024Z","contentChangedAt":"2026-09-03T12:38:19.024Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}