{"id":"ce3a56330fd13b06","repo":"drizzle-team/drizzle-orm","slug":"can-t-find-meta-journal-json-file","errorCode":null,"errorMessage":"Can't find meta/_journal.json file","messagePattern":"Can't find meta/_journal\\.json file","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"drizzle-orm/src/migrator.ts","lineNumber":29,"sourceCode":"\tmigrationsTable?: string;\n\tmigrationsSchema?: string;\n}\n\nexport interface MigrationMeta {\n\tsql: string[];\n\tfolderMillis: number;\n\thash: string;\n\tbps: boolean;\n}\n\nexport function readMigrationFiles(config: MigrationConfig): MigrationMeta[] {\n\tconst migrationFolderTo = config.migrationsFolder;\n\n\tconst migrationQueries: MigrationMeta[] = [];\n\n\tconst journalPath = `${migrationFolderTo}/meta/_journal.json`;\n\tif (!fs.existsSync(journalPath)) {\n\t\tthrow new Error(`Can't find meta/_journal.json file`);\n\t}\n\n\tconst journalAsString = fs.readFileSync(`${migrationFolderTo}/meta/_journal.json`).toString();\n\n\tconst journal = JSON.parse(journalAsString) as {\n\t\tentries: { idx: number; when: number; tag: string; breakpoints: boolean }[];\n\t};\n\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","sourceCodeStart":11,"sourceCodeEnd":47,"githubUrl":"https://github.com/drizzle-team/drizzle-orm/blob/b7862528fd8fc39bc2653a6c18dad7c1f4e68d10/drizzle-orm/src/migrator.ts#L11-L47","documentation":"Thrown by readMigrationFiles in migrator.ts (line 29) when meta/_journal.json does not exist inside the configured migrationsFolder. Drizzle Kit writes this journal to track migration order; its absence means migrations were never generated or the folder path is wrong.","triggerScenarios":"Calling migrate() with a migrationsFolder that lacks a meta/_journal.json file. Happens when the folder doesn't exist, points to the wrong directory, or drizzle-kit generate was never run.","commonSituations":"Wrong/typo'd migrationsFolder path in migrate() config; migrations generated to a different folder than the one passed; fresh repo where drizzle-kit generate hasn't been run yet; CI running migrations before generating them.","solutions":["Run `drizzle-kit generate` to create the migrations folder, meta/_journal.json, and initial .sql files.","Verify the migrationsFolder path in migrate() matches the `out` folder in drizzle.config.ts exactly (resolve relative to process.cwd()).","Ensure the migrations folder is committed and deployed alongside your app so meta/_journal.json is present at runtime.","Use an absolute path (path.resolve) for migrationsFolder to avoid cwd ambiguity."],"exampleFix":"// before - wrong/missing folder\nimport { migrate } from 'drizzle-orm/libsql/migrator';\nawait migrate(db, { migrationsFolder: './drizzle' }); // no meta/_journal.json\n\n// after - correct folder + ensure generated\n// drizzle.config.ts: { out: './drizzle/migrations' }\nimport path from 'node:path';\nawait migrate(db, { migrationsFolder: path.resolve('./drizzle/migrations') });\n// run: drizzle-kit generate","handlingStrategy":"validation","validationCode":"import fs from 'node:fs';\nimport path from 'node:path';\nconst journal = path.join(folder, 'meta', '_journal.json');\nif (!fs.existsSync(journal)) {\n  throw new Error(`Run 'drizzle-kit generate'. Missing ${journal}`);\n}","typeGuard":"function migrationsReady(folder: string): boolean {\n  return fs.existsSync(path.join(folder, 'meta', '_journal.json'));\n}","tryCatchPattern":null,"preventionTips":["Run drizzle-kit generate before migrate at deploy time.","Use the same folder path in drizzle.config.ts `out` and migrate() `migrationsFolder`.","Commit and ship the migrations folder including meta/_journal.json.","Use absolute paths resolved from process.cwd()."],"tags":["migrations","config","filesystem","drizzle-kit"],"analyzedSha":"b7862528fd8fc39bc2653a6c18dad7c1f4e68d10","analyzedAt":"2026-08-03T18:11:14.318Z","schemaVersion":2}