{"record":{"id":"d55fc7e315c6016c","repo":"toeverything/AFFiNE","slug":"unknown-migration-name-name","errorCode":null,"errorMessage":"Unknown migration name: ${name}.","messagePattern":"Unknown migration name: (.+?)\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/backend/server/src/data/commands/run.ts","lineNumber":86,"sourceCode":"      }\n\n      await this.runMigration(migration);\n\n      done.push(migration);\n    }\n\n    this.logger.log(`Done ${done.length} migrations`);\n    done.forEach(migration => {\n      this.logger.log(`  ✔ ${migration.name}`);\n    });\n  }\n\n  async runOne(name: string) {\n    const migrations = collectMigrations();\n    const migration = migrations.find(m => m.name === name);\n\n    if (!migration) {\n      throw new Error(`Unknown migration name: ${name}.`);\n    }\n    const exists = await this.db.dataMigration.count({\n      where: {\n        name: migration.name,\n      },\n    });\n\n    if (exists) return;\n\n    await this.runMigration(migration);\n  }\n\n  async admitLegacyContextBlobs(): Promise<void> {\n    const tables = await this.db.$queryRaw<\n      Array<{\n        contexts: string | null;\n        sessions: string | null;\n        blobs: string | null;","sourceCodeStart":68,"sourceCodeEnd":104,"githubUrl":"https://github.com/toeverything/AFFiNE/blob/591f874dad30887a80143a061a44bd3ca7ee3299/packages/backend/server/src/data/commands/run.ts#L68-L104","documentation":"Thrown by RunCommand.runOne(name) when the requested data migration name is not found among the migrations collected from the migrations index (each file exports a name, and lookups are exact string matches).","triggerScenarios":"Running the 'data run <name>' CLI command with a typo'd, case-mismatched, or nonexistent migration name.","commonSituations":"Name copied from an old version's migration list that no longer exists in the deployed build; trailing whitespace or wrong casing in the shell argument; referring to a file name instead of the exported migration name.","solutions":["List the actual migration names available in your build (src/data/migrations index, or run the run-all command which logs each '✔ <name>' as it executes) and copy the exact name.","Match casing and digits exactly — migration names end with a numeric suffix that must be included.","Upgrade/downgrade the server image to the version that contains the migration you are targeting."],"exampleFix":"// before\n$ node cli.js data run fix-user-avatar  # typo\n// after\n$ node cli.js data run fix-user-avatar-1700000000","handlingStrategy":"validation","validationCode":"// Verify the name exists before running (server-side helper)\nimport { collectMigrations } from './commands/run';\nconst names = collectMigrations().map(m => m.name);\nif (!names.includes(name)) {\n  console.error(`Unknown migration. Available:\\n${names.join('\\n')}`);\n  process.exit(1);\n}","typeGuard":"const isValidMigrationName = (name: string): boolean =>\n  collectMigrations().some(m => m.name === name);","tryCatchPattern":null,"preventionTips":["Source migration names from collectMigrations() output rather than hand-typing them.","Include the full name with its trailing numeric suffix when scripting."],"tags":["cli","migration","data","name-mismatch"],"backgroundTag":"unknown-migration-name","analyzedSha":"591f874dad30887a80143a061a44bd3ca7ee3299","analyzedAt":"2026-08-18T21:16:52.546Z","contentChangedAt":"2026-08-18T21:16:52.546Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}