{"record":{"id":"5815901e8278c753","repo":"diesel-rs/diesel","slug":"failed-to-read-migration-literals","errorCode":null,"errorMessage":"Failed to read migration literals","messagePattern":"Failed to read migration literals","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"diesel_migrations/migrations_macros/src/embed_migrations.rs","lineNumber":19,"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()\n        .map(|e| migration_literal_from_path(&e.path()))\n        .collect())\n}","sourceCodeStart":1,"sourceCodeEnd":37,"githubUrl":"https://github.com/diesel-rs/diesel/blob/6fa6ed01b24b24248ab2a611698d0a7c6a2e9120/diesel_migrations/migrations_macros/src/embed_migrations.rs#L1-L37","documentation":"The migration embedding macro failed while reading the SQL literals from the discovered migration directory. The offending input is the directory contents, such as unreadable files or malformed migration entries.","triggerScenarios":"Thrown at diesel_migrations/migrations_macros/src/embed_migrations.rs:19 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure migration files exist and are readable","Verify each migration file contains valid SQL","Check directory permissions and file naming"],"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"}