Hmbown/CodeWhale · error
Create lookups always yield a table
Error message
Create lookups always yield a table
What it means
set_config_document_value splits the key path into parents + final key, asks table_like_at_path_mut for PathLookup::Create, and expects a table back. The Create lookup is contractually guaranteed to build and return a table, so a None would mean an internal bug in table_like_at_path_mut; this expect documents and enforces that invariant.
Solutions
- Debug table_like_at_path_mut: under PathLookup::Create it must insert and return a table for each missing segment.
- Add/repair the unit test covering Create on a missing intermediate segment.
- Report as a bug — this is an internal invariant, not an input error.
Defensive patterns
Strategy: try-catch
Try / catch
// unreachable from user input; treat any panic here as a bug report std::panic::catch_unwind(|| store.set(&path, value))
Prevention
- Keep unit tests covering PathLookup::Create on missing intermediate tables.
- Never bypass the shared document lock when mutating the config.
- Review changes to table_like_at_path_mut against its Create contract.
When it happens
Trigger: Only reachable if table_like_at_path_mut(doc.as_table_mut(), parents, PathLookup::Create) returns Ok(None) — a violation of its Create contract while setting a config value via targeted mutations (provider edits, lock revoke/update tests).
Common situations: A code change to table_like_at_path_mut breaking the Create contract; never from user input — end users cannot trigger it through the public config-store API.
Understand the failure class
Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.
Related errors
- segment exists or was inserted above
- provider authority checked above
- a CNB access token is not configured in the Codewhale…
- account_agent_model_unconfigured
- active plugin registry is missing its pre-dotenv…
AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22).
Data as JSON: /api/errors/a2d8af989e386eeb.
Report an issue: GitHub.
Appendix: source
Thrown at crates/config/src/config_document.rs:131
crate::quote_os_path(path)
);
}
persist_locked(path, current.as_deref(), body.as_bytes())
})
}
/// Set a value at `segments`, creating implicit parent tables while preserving
/// existing key/value decor.
pub fn set_config_document_value(
doc: &mut toml_edit::DocumentMut,
segments: &[&str],
value: impl Into<toml_edit::Value>,
) -> Result<()> {
let (key, parents) = segments
.split_last()
.context("config value path must not be empty")?;
let table = table_like_at_path_mut(doc.as_table_mut(), parents, PathLookup::Create)?
.expect("Create lookups always yield a table");
match table.get_mut(key) {
Some(item) => {
let mut value = value.into();
if let Some(existing) = item.as_value() {
*value.decor_mut() = existing.decor().clone();
}
*item = toml_edit::Item::Value(value);
}
None => {
table.insert(key, toml_edit::value(value));
}
}
Ok(())
}
/// Remove a value at `segments` without disturbing unrelated tables or decor.
pub fn unset_config_document_value(
doc: &mut toml_edit::DocumentMut,View on GitHub (pinned to 73e0f67d83)