{"record":{"id":"93d48c579c1dd413","repo":"eyaltoledano/claude-task-master","slug":"taskmaster-directory-already-exists-use-force","errorCode":null,"errorMessage":".taskmaster directory already exists. Use --force to overwrite or skip migration.","messagePattern":"\\.taskmaster directory already exists\\. Use --force to overwrite or skip migration\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"scripts/modules/task-manager/migrate.js","lineNumber":35,"sourceCode":"\tinfo: (msg) => console.log(chalk.blue('ℹ'), msg),\n\twarn: (msg) => console.log(chalk.yellow('⚠'), msg),\n\terror: (msg) => console.error(chalk.red('✗'), msg),\n\tsuccess: (msg) => console.log(chalk.green('✓'), msg)\n});\n\n/**\n * Main migration function\n * @param {Object} options - Migration options\n */\nexport async function migrateProject(options = {}) {\n\tconst projectRoot = findProjectRoot() || process.cwd();\n\n\tlog.info(`Starting migration in: ${projectRoot}`);\n\n\t// Check if .taskmaster directory already exists\n\tconst taskmasterDir = path.join(projectRoot, '.taskmaster');\n\tif (fs.existsSync(taskmasterDir) && !options.force) {\n\t\tlog.warn(\n\t\t\t'.taskmaster directory already exists. Use --force to overwrite or skip migration.'\n\t\t);\n\t\treturn;\n\t}\n\n\t// Analyze what needs to be migrated\n\tconst migrationPlan = analyzeMigrationNeeds(projectRoot);\n\n\tif (migrationPlan.length === 0) {\n\t\tlog.info(\n\t\t\t'No files to migrate. Project may already be using the new structure.'\n\t\t);\n\t\treturn;\n\t}\n\n\t// Show migration plan\n\tlog.info('Migration plan:');\n\tfor (const item of migrationPlan) {","sourceCodeStart":17,"sourceCodeEnd":53,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/scripts/modules/task-manager/migrate.js#L17-L53","documentation":"migrateProject performs the legacy-to-new layout migration (moving files into .taskmaster/). If the destination .taskmaster directory already exists and --force was not passed, migration aborts with this warning before touching anything, to avoid clobbering an existing installation.","triggerScenarios":"Running the migrate command (registered via registerCommands) in a project root where .taskmaster/ already exists, without options.force set.","commonSituations":"Re-running migration after a partial/complete migration; running migrate in a project already on the new layout by mistake; forgetting the --force flag when intentionally re-migrating.","solutions":["If the project is already migrated, do nothing — this is expected.","If you intentionally want to re-run and overwrite, re-run with --force: task-master migrate --force.","Back up the .taskmaster directory before using --force so nothing is lost."],"exampleFix":"// before\ntask-master migrate\n// after\ntask-master migrate --force","handlingStrategy":"validation","validationCode":"const fs = require('fs');\nif (fs.existsSync('.taskmaster')) {\n  console.log('Already migrated; skipping (or pass --force to overwrite)');\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Check for .taskmaster/ existence before scheduling migration in CI.","Only use --force after backing up .taskmaster.","Run migration once per project and record that in setup scripts."],"tags":["migration","filesystem","idempotency"],"backgroundTag":"directory-already-exists","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}