{"id":"45401a4488fed9ef","repo":"drizzle-team/drizzle-orm","slug":"no-file-migrationpath-found-in-migrationfolde","errorCode":null,"errorMessage":"No file ${migrationPath} found in ${migrationFolderTo} folder","messagePattern":"No file (.+?) found in (.+?) folder","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"drizzle-orm/src/migrator.ts","lineNumber":55,"sourceCode":"\n\tfor (const journalEntry of journal.entries) {\n\t\tconst migrationPath = `${migrationFolderTo}/${journalEntry.tag}.sql`;\n\n\t\ttry {\n\t\t\tconst query = fs.readFileSync(`${migrationFolderTo}/${journalEntry.tag}.sql`).toString();\n\n\t\t\tconst result = query.split('--> statement-breakpoint').map((it) => {\n\t\t\t\treturn it;\n\t\t\t});\n\n\t\t\tmigrationQueries.push({\n\t\t\t\tsql: result,\n\t\t\t\tbps: journalEntry.breakpoints,\n\t\t\t\tfolderMillis: journalEntry.when,\n\t\t\t\thash: crypto.createHash('sha256').update(query).digest('hex'),\n\t\t\t});\n\t\t} catch {\n\t\t\tthrow new Error(`No file ${migrationPath} found in ${migrationFolderTo} folder`);\n\t\t}\n\t}\n\n\treturn migrationQueries;\n}\n","sourceCodeStart":37,"sourceCodeEnd":61,"githubUrl":"https://github.com/drizzle-team/drizzle-orm/blob/b7862528fd8fc39bc2653a6c18dad7c1f4e68d10/drizzle-orm/src/migrator.ts#L37-L61","documentation":"Thrown by readMigrationFiles in migrator.ts (line 55) when the journal references a migration .sql file (by tag) that cannot be read from disk. The journal entry exists but its corresponding <tag>.sql file is missing, deleted, or never written.","triggerScenarios":"meta/_journal.json lists an entry whose tag (e.g. 0001_initial) has no matching .sql file in the migrations folder. The readFileSync inside the loop throws and is caught, then re-thrown with this descriptive message.","commonSituations":"A migration .sql file was manually deleted or git-ignored while the journal still references it; partial/failed `drizzle-kit generate`; mismatched casing across filesystems (case-insensitive dev, case-sensitive deploy); files not included in the deployment artifact.","solutions":["Restore the missing .sql file from version control, or regenerate it with drizzle-kit generate using the same schema snapshot.","If the migration was intentionally removed, edit meta/_journal.json to drop the corresponding entry (advanced - ensure DB state matches).","Ensure all .sql files are committed and shipped to the deployment environment (check .gitignore, Dockerfile COPY).","Verify filesystem casing of the .sql filename matches the journal tag exactly."],"exampleFix":"// before - journal references 0002_add_email.sql which is missing\nawait migrate(db, { migrationsFolder: './drizzle' });\n// Error: No file ./drizzle/0002_add_email.sql found\n\n// after - restore the file (git checkout) or regenerate\n// git: git checkout HEAD -- drizzle/0002_add_email.sql\n// then re-run migrate\nawait migrate(db, { migrationsFolder: './drizzle' });","handlingStrategy":"validation","validationCode":"import fs from 'node:fs';\nimport path from 'node:path';\nconst journal = JSON.parse(fs.readFileSync(path.join(folder, 'meta', '_journal.json'), 'utf8'));\nfor (const e of journal.entries) {\n  if (!fs.existsSync(path.join(folder, `${e.tag}.sql`))) {\n    throw new Error(`Missing migration ${e.tag}.sql`);\n  }\n}","typeGuard":"function allMigrationsPresent(folder: string): boolean {\n  const journal = JSON.parse(fs.readFileSync(path.join(folder, 'meta/_journal.json'), 'utf8'));\n  return journal.entries.every((e: any) => fs.existsSync(path.join(folder, `${e.tag}.sql`)));\n}","tryCatchPattern":null,"preventionTips":["Commit all .sql files and meta/_journal.json together.","Don't gitignore migration .sql files.","Keep filename casing consistent with journal tags.","Regenerate migrations from version control rather than editing by hand."],"tags":["migrations","filesystem","consistency","drizzle-kit"],"analyzedSha":"b7862528fd8fc39bc2653a6c18dad7c1f4e68d10","analyzedAt":"2026-08-03T18:11:14.318Z","schemaVersion":2}