{"record":{"id":"d9a5dd44a47c09f5","repo":"Hmbown/CodeWhale","slug":"imported-configuration-has-an-invalid-toml-type-contents","errorCode":null,"errorMessage":"imported configuration has an invalid TOML type; contents omitted","messagePattern":"imported configuration has an invalid TOML type; contents omitted","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/cli/src/config_bundles.rs","lineNumber":1296,"sourceCode":"        edits.push((dotted.to_string(), key.to_string(), value.to_string()));\n    } else if (key == \"providers\" || key.starts_with(\"providers.\"))\n        && let Some(table) = value.as_table()\n    {\n        for (child, value) in table {\n            collect_model_edits(\n                &format!(\"{dotted}.{child}\"),\n                &format!(\"{key}.{child}\"),\n                value,\n                edits,\n            )?;\n        }\n    }\n    Ok(())\n}\n\nfn config_from_document(body: &str) -> Result<ConfigToml> {\n    let mut config: ConfigToml = toml::from_str(body).map_err(|_| {\n        anyhow!(\"imported configuration has an invalid TOML type; contents omitted\")\n    })?;\n    let document: toml::Value = toml::from_str(body)?;\n    if let Some(provider) = document.get(\"provider\").and_then(toml::Value::as_str) {\n        config.bind_persisted_provider_id(provider)?;\n    }\n    Ok(config)\n}\n\nfn save_candidate(\n    candidate: ConfigToml,\n    store: &mut codewhale_config::ConfigStore,\n    target_written: &mut bool,\n) -> Result<()> {\n    store.config = candidate;\n    store.save().context(\"saving imported bundle\")?;\n    *target_written = true;\n    Ok(())\n}","sourceCodeStart":1278,"sourceCodeEnd":1314,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/cli/src/config_bundles.rs#L1278-L1314","documentation":"config_from_document parses bundle body text into the typed ConfigToml. Any type mismatch between the bundle's TOML values and ConfigToml's field types (serde deserialization error) triggers this message, which deliberately hides the body contents from output. A valid provider selector found in the raw document is then bound to the parsed config.","triggerScenarios":"toml::from_str::<ConfigToml>(body) fails because bundle values do not match the typed schema — e.g. numeric fields given strings, tables where scalars are expected, wrong enum-like values.","commonSituations":"Bundles produced by newer/older versions with drifted schema, hand-edited bundles with wrong value types, corrupted or truncated bundle files.","solutions":["Fix the offending value types in the bundle so they match the ConfigToml schema.","Regenerate the bundle by exporting from a working installation of the same version.","Align exporter/importer versions to eliminate schema drift.","Validate the bundle body parses as TOML and spot-check field types before importing."],"exampleFix":"// before (bundle body)\nmodel_alias_count = \"three\"\n// after (bundle body)\nmodel_alias_count = 3","handlingStrategy":"validation","validationCode":"let body = std::fs::read_to_string(bundle_file)?; let probe: Result<ConfigToml, _> = toml::from_str(&body); if probe.is_err() { eprintln!(\"bundle does not match current ConfigToml schema\"); }","typeGuard":null,"tryCatchPattern":"match config_from_document(&body) { Err(e) if e.to_string().contains(\"invalid TOML type\") => eprintln!(\"bundle schema mismatch; regenerate bundle\"), other => other, }","preventionTips":["Generate bundles only via export from a matching version.","Never hand-edit bundle value types.","Check version compatibility before importing cross-version bundles.","Validate the bundle against the schema before applying."],"tags":["toml","config","deserialization"],"backgroundTag":"config-type-mismatch","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}