{"record":{"id":"a2d8af989e386eeb","repo":"Hmbown/CodeWhale","slug":"create-lookups-always-yield-a-table","errorCode":null,"errorMessage":"Create lookups always yield a table","messagePattern":"Create lookups always yield a table","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/config/src/config_document.rs","lineNumber":121,"sourceCode":"                crate::quote_os_path(path)\n            );\n        }\n        persist_locked(path, current.as_deref(), body.as_bytes())\n    })\n}\n\n/// Set a value at `segments`, creating implicit parent tables while preserving\n/// existing key/value decor.\npub fn set_config_document_value(\n    doc: &mut toml_edit::DocumentMut,\n    segments: &[&str],\n    value: impl Into<toml_edit::Value>,\n) -> Result<()> {\n    let (key, parents) = segments\n        .split_last()\n        .context(\"config value path must not be empty\")?;\n    let table = table_like_at_path_mut(doc.as_table_mut(), parents, PathLookup::Create)?\n        .expect(\"Create lookups always yield a table\");\n    match table.get_mut(key) {\n        Some(item) => {\n            let mut value = value.into();\n            if let Some(existing) = item.as_value() {\n                *value.decor_mut() = existing.decor().clone();\n            }\n            *item = toml_edit::Item::Value(value);\n        }\n        None => {\n            table.insert(key, toml_edit::value(value));\n        }\n    }\n    Ok(())\n}\n\n/// Remove a value at `segments` without disturbing unrelated tables or decor.\npub fn unset_config_document_value(\n    doc: &mut toml_edit::DocumentMut,","sourceCodeStart":103,"sourceCodeEnd":139,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/0c42157ee52f9d55af2b506d71b46249910f77d3/crates/config/src/config_document.rs#L103-L139","documentation":"Internal invariant in set_config_document_value's table traversal: a lookup performed with PathLookup::Create was expected to always produce a table-like entry, but it did not — indicates corrupted document structure or a bug, not user input.","triggerScenarios":"Thrown at crates/config/src/config_document.rs:121 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["This should not occur in normal use; report it as a bug with the config path and value being set","Regenerate or hand-fix the affected config file as a workaround"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"0c42157ee52f9d55af2b506d71b46249910f77d3","analyzedAt":"2026-08-20T21:50:45.477Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}