{"record":{"id":"ec2bab6504ebb7f5","repo":"tracel-ai/burn","slug":"invalid-split-specified-split","errorCode":null,"errorMessage":"Invalid split specified {split}","messagePattern":"Invalid split specified (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/burn-dataset/src/vision/mnist.rs","lineNumber":141,"sourceCode":"            .expect(\"Could not get cache directory\")\n            .join(\"burn-dataset\");\n        let split_dir = cache_dir.join(\"mnist\").join(split);\n\n        if !split_dir.exists() {\n            create_dir_all(&split_dir).expect(\"Failed to create base directory\");\n        }\n\n        // Download split files\n        match split {\n            \"train\" => {\n                MnistDataset::download_file(TRAIN_IMAGES, &split_dir);\n                MnistDataset::download_file(TRAIN_LABELS, &split_dir);\n            }\n            \"test\" => {\n                MnistDataset::download_file(TEST_IMAGES, &split_dir);\n                MnistDataset::download_file(TEST_LABELS, &split_dir);\n            }\n            _ => panic!(\"Invalid split specified {split}\"),\n        };\n\n        split_dir\n    }\n\n    /// Download a file from the MNIST dataset URL to the destination directory.\n    /// File download progress is reported with the help of a [progress bar](indicatif).\n    fn download_file<P: AsRef<Path>>(name: &str, dest_dir: &P) -> PathBuf {\n        // Output file name\n        let file_name = dest_dir.as_ref().join(name);\n\n        if !file_name.exists() {\n            // Download gzip file\n            let bytes = download_file_as_bytes(&format!(\"{URL}{name}.gz\"), name);\n\n            // Create file to write the downloaded content to\n            let mut output_file = File::create(&file_name).unwrap();\n","sourceCodeStart":123,"sourceCodeEnd":159,"githubUrl":"https://github.com/tracel-ai/burn/blob/d16f7ba2ed0d41408189384044cc886fb4c8f957/crates/burn-dataset/src/vision/mnist.rs#L123-L159","documentation":"Input-validation guard in MNIST dataset download: the `split` argument must be exactly \"train\" or \"test\"; the match arms download the corresponding file set and the fallback panics with the offending value. It fires when a caller passes any other split name (typo, casing, or an unsupported split) to `MnistDataset::download`.","triggerScenarios":"Thrown at crates/burn-dataset/src/vision/mnist.rs:141 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass `\"train\"` or `\"test\"` as the split, matching case exactly.","Normalize/validate the split string before calling the dataset constructor.","If a new split is required, add a match arm with the corresponding file URLs."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"d16f7ba2ed0d41408189384044cc886fb4c8f957","analyzedAt":"2026-09-05T13:19:14.260Z","contentChangedAt":"2026-09-05T13:19:14.260Z","schemaVersion":2},"datasetVersion":"2026-09-12T17:17:11.597Z"}