{"record":{"id":"b9848192895a7edf","repo":"xai-org/grok-build","slug":"paths-is-not-a-table","errorCode":null,"errorMessage":"[paths] is not a table","messagePattern":"\\[paths\\] is not a table","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/codegen/xai-grok-shell/src/claude_import.rs","lineNumber":1009,"sourceCode":"    }\n    Ok(count)\n}\n\n/// Merge a list of path strings into `[paths] <key>` (an array of strings).\n///\n/// Existing entries are preserved; new entries that aren't already present\n/// are appended. Returns the number of newly added entries.\nfn merge_paths(\n    table: &mut TomlMap<String, TomlValue>,\n    key: &str,\n    new_paths: &[&str],\n) -> anyhow::Result<usize> {\n    let paths = table\n        .entry(\"paths\")\n        .or_insert_with(|| TomlValue::Table(TomlMap::new()));\n    let paths_table = paths\n        .as_table_mut()\n        .ok_or_else(|| anyhow::anyhow!(\"[paths] is not a table\"))?;\n\n    let arr = paths_table\n        .entry(key)\n        .or_insert_with(|| TomlValue::Array(Vec::new()));\n    let existing = arr\n        .as_array_mut()\n        .ok_or_else(|| anyhow::anyhow!(\"paths.{key} is not an array\"))?;\n\n    let existing_set: std::collections::HashSet<String> = existing\n        .iter()\n        .filter_map(|v| v.as_str().map(|s| s.to_string()))\n        .collect();\n\n    let mut count = 0usize;\n    for p in new_paths {\n        if !existing_set.contains(*p) {\n            existing.push(TomlValue::String(p.to_string()));\n            count += 1;","sourceCodeStart":991,"sourceCodeEnd":1027,"githubUrl":"https://github.com/xai-org/grok-build/blob/bc7f02eddd3d84085849dc19ed216f11c23b0571/crates/codegen/xai-grok-shell/src/claude_import.rs#L991-L1027","documentation":"merge_paths found a paths key whose value is not a table, so the per-key path arrays cannot be merged. Only a missing paths key is auto-created as an empty table; an existing non-table value fails instead of being overwritten.","triggerScenarios":"apply_items_to_config merges path entries while the config has a non-table value at the root key paths, e.g. paths = \"/some/dir\".","commonSituations":"User set paths to a single string instead of a [paths] section; an earlier tool stored a scalar under paths.","solutions":["Replace the scalar with a [paths] section whose values are arrays of strings.","Delete the malformed paths key and re-run the import so the table is created.","Use an inline table: paths = { include = [], exclude = [] }."],"exampleFix":"// before (config.toml)\npaths = \"/home/user/project\"\n\n// after\n[paths]\ninclude = [\"/home/user/project\"]","handlingStrategy":"validation","validationCode":"let root: toml::Value = toml::from_str(&std::fs::read_to_string(&path)?)?;\nif let Some(v) = root.get(\"paths\") {\n    if !v.is_table() {\n        anyhow::bail!(\"paths must be a [paths] table of arrays\");\n    }\n}","typeGuard":"fn paths_is_table(root: &toml::Value) -> bool {\n    root.get(\"paths\").map(|v| v.is_table()).unwrap_or(true)\n}","tryCatchPattern":"if let Err(e) = apply_import(items, &path) {\n    if e.to_string().contains(\"[paths] is not a table\") {\n        eprintln!(\"Convert paths to a [paths] section with array values, then retry\");\n    } else {\n        return Err(e.into());\n    }\n}","preventionTips":["Store path lists as arrays under a [paths] section, never as a single string.","Validate paths.* values are tables of arrays before importing.","Let the importer create the section instead of hand-writing it."],"tags":["toml","config","schema"],"backgroundTag":"invalid-toml-config","analyzedSha":"bc7f02eddd3d84085849dc19ed216f11c23b0571","analyzedAt":"2026-08-31T04:59:42.031Z","schemaVersion":2},"datasetVersion":"2026-08-31T09:17:48.483Z"}