{"record":{"id":"4797b94e364ee152","repo":"DioxusLabs/dioxus","slug":"failed-to-parse-toml-at","errorCode":null,"errorMessage":"failed to parse toml at {}: {}","messagePattern":"failed to parse toml at (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/cli/src/cli/create.rs","lineNumber":198,"sourceCode":"    // 2. Run `cargo fmt` on the new project.\n    let mut cmd = Command::new(\"cargo\");\n    let cmd = cmd.arg(\"fmt\").current_dir(path);\n    let output = cmd.output().expect(\"failed to execute process\");\n    if !output.status.success() {\n        tracing::error!(dx_src = ?TraceSrc::Dev, \"cargo fmt failed\");\n        tracing::error!(dx_src = ?TraceSrc::Build, \"stdout: {}\", String::from_utf8_lossy(&output.stdout));\n        tracing::error!(dx_src = ?TraceSrc::Build, \"stderr: {}\", String::from_utf8_lossy(&output.stderr));\n    }\n\n    // 3. Format the `Cargo.toml` and `Dioxus.toml` files.\n    let toml_paths = [path.join(\"Cargo.toml\"), path.join(\"Dioxus.toml\")];\n    for toml_path in &toml_paths {\n        let Ok(toml) = std::fs::read_to_string(toml_path) else {\n            continue;\n        };\n\n        let mut toml = toml.parse::<toml_edit::DocumentMut>().map_err(|e| {\n            anyhow::anyhow!(\"failed to parse toml at {}: {}\", toml_path.display(), e)\n        })?;\n\n        toml.as_table_mut().fmt();\n\n        let as_string = toml.to_string();\n        let new_string = remove_triple_newlines(&as_string);\n        let mut file = std::fs::File::create(toml_path)?;\n        file.write_all(new_string.as_bytes())?;\n    }\n\n    // 4. Remove any triple newlines from the readme.\n    let readme_path = path.join(\"README.md\");\n    let readme = std::fs::read_to_string(&readme_path)?;\n    let new_readme = remove_triple_newlines(&readme);\n    let mut file = std::fs::File::create(readme_path)?;\n    file.write_all(new_readme.as_bytes())?;\n\n    // 5. Run git init","sourceCodeStart":180,"sourceCodeEnd":216,"githubUrl":"https://github.com/DioxusLabs/dioxus/blob/24f6a829df0dfa203961a98ea4cae21c2ff27e28/packages/cli/src/cli/create.rs#L180-L216","documentation":"Error path in post_create when the freshly generated Cargo.toml or Dioxus.toml of the new project fails to parse with the toml crate. Fires when template serialization produced malformed TOML at the given path — unexpected for a working template, so it usually indicates a corrupted template or a bad write.","triggerScenarios":"Thrown at packages/cli/src/cli/create.rs:198 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["A TOML file could not be parsed. Fix the TOML syntax at the reported path."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"24f6a829df0dfa203961a98ea4cae21c2ff27e28","analyzedAt":"2026-08-23T07:10:14.078Z","contentChangedAt":"2026-08-23T07:10:14.078Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}