{"record":{"id":"6482c93697ac08ca","repo":"diesel-rs/diesel","slug":"failed-to-receive-migrations-dir-from-migrations","errorCode":null,"errorMessage":"Failed to receive migrations dir from {migrations_path_opt:?}","messagePattern":"Failed to receive migrations dir from (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"diesel_migrations/migrations_macros/src/embed_migrations.rs","lineNumber":16,"sourceCode":"use crate::migrations::migration_directory_from_given_path;\nuse migrations_internals::{TomlMetadata, migrations_directories, version_from_string};\nuse quote::quote;\nuse std::error::Error;\nuse std::fs::DirEntry;\nuse std::path::Path;\n\npub fn expand(path: String) -> proc_macro2::TokenStream {\n    let migrations_path_opt = if path.is_empty() {\n        None\n    } else {\n        Some(path.replace('\"', \"\"))\n    };\n    let migrations_expr = migration_directory_from_given_path(migrations_path_opt.as_deref())\n        .unwrap_or_else(|_| {\n            panic!(\"Failed to receive migrations dir from {migrations_path_opt:?}\")\n        });\n    let embedded_migrations =\n        migration_literals_from_path(&migrations_expr).expect(\"Failed to read migration literals\");\n\n    quote! {\n        diesel_migrations::EmbeddedMigrations::new(&[#(#embedded_migrations,)*])\n    }\n}\n\nfn migration_literals_from_path(\n    path: &Path,\n) -> Result<Vec<proc_macro2::TokenStream>, Box<dyn Error>> {\n    let mut migrations = migrations_directories(path)?.collect::<Result<Vec<_>, _>>()?;\n\n    migrations.sort_by_key(DirEntry::path);\n\n    Ok(migrations\n        .into_iter()","sourceCodeStart":1,"sourceCodeEnd":34,"githubUrl":"https://github.com/diesel-rs/diesel/blob/6fa6ed01b24b24248ab2a611698d0a7c6a2e9120/diesel_migrations/migrations_macros/src/embed_migrations.rs#L1-L34","documentation":"The migration embedding macro could not resolve a migrations directory from the given or default path. The offending input is the migration path option; the directory lookup failed before any migration file was read.","triggerScenarios":"Thrown at diesel_migrations/migrations_macros/src/embed_migrations.rs:16 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass an explicit, valid migrations directory path","Ensure the default migrations directory exists and is readable","Check the path spelling and remove stray quotes"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"6fa6ed01b24b24248ab2a611698d0a7c6a2e9120","analyzedAt":"2026-09-07T01:50:13.074Z","contentChangedAt":"2026-09-07T01:50:13.074Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}