{"record":{"id":"6d20dd04d55e6d58","repo":"astrid-runtime/astrid","slug":"cargo-include-table-must-contain-a-string-path-in","errorCode":null,"errorMessage":"Cargo include table must contain a string path in {}","messagePattern":"Cargo include table must contain a string path in (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-build/src/rust/config.rs","lineNumber":231,"sourceCode":"    let Some(item) = doc.get(\"include\") else {\n        return Ok(Vec::new());\n    };\n\n    if let Some(value) = item.as_str() {\n        return Ok(vec![resolve_cargo_config_include(path, value, false)?]);\n    }\n    if let Some(array) = item.as_array() {\n        return array\n            .iter()\n            .map(|value| {\n                if let Some(include) = value.as_str() {\n                    Ok(resolve_cargo_config_include(path, include, false)?)\n                } else if let Some(table) = value.as_inline_table() {\n                    let include = table\n                        .get(\"path\")\n                        .and_then(toml_edit::Value::as_str)\n                        .ok_or_else(|| {\n                            anyhow::anyhow!(\n                                \"Cargo include table must contain a string path in {}\",\n                                path.display()\n                            )\n                        })?;\n                    let optional = match table.get(\"optional\") {\n                        None => false,\n                        Some(value) => value.as_bool().ok_or_else(|| {\n                            anyhow::anyhow!(\n                                \"Cargo include optional must be a boolean in {}\",\n                                path.display()\n                            )\n                        })?,\n                    };\n                    Ok(resolve_cargo_config_include(path, include, optional)?)\n                } else {\n                    bail!(\n                        \"Cargo include array contains a non-string or non-table value in {}\",\n                        path.display()","sourceCodeStart":213,"sourceCodeEnd":249,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-build/src/rust/config.rs#L213-L249","documentation":"When parsing an inline `[include]` table inside .cargo/config.toml (toml_edit path), the `path` key must be a TOML string. cargo_config_includes throws this if the table exists but `path` is missing or is not a string.","triggerScenarios":"load_content parsing a config file containing an inline include table like `include = { path = 123 }` or `include = { optional = true }` with no `path` key, at the inline-table branch of cargo_config_includes.","commonSituations":"Hand-edited .cargo/config.toml where the path value was quoted wrongly, wrapped in a non-string type, or accidentally deleted; copy-paste of TOML snippets between formats.","solutions":["Add a string `path` key to the include table","Quote the path value: `path = \"path/to/config.toml\"`","Remove non-string values from the path field","Validate the config with a TOML linter before building"],"exampleFix":"# before\ninclude = { optional = true }\n# after\ninclude = { path = \".cargo/extra.toml\", optional = true }","handlingStrategy":"validation","validationCode":"fn validate_inline_include(t: &toml::Value) -> Result<(), String> {\n    t.get(\"path\").and_then(|p| p.as_str())\n        .map(|_| ())\n        .ok_or_else(|| \"include table requires a string `path`\".into())\n}","typeGuard":"fn has_string_path(t: &toml::Value) -> bool {\n    t.get(\"path\").and_then(toml::Value::as_str).is_some()\n}","tryCatchPattern":"match load_content(...) {\n    Err(e) if e.to_string().contains(\"must contain a string path\") => {\n        eprintln!(\"fix the include table in your .cargo/config.toml\");\n    }\n    other => other?,\n}","preventionTips":["Always quote include paths in TOML","Run a TOML schema check on .cargo/config.toml in CI","Never omit the path key when using an include table"],"tags":["toml","config","cargo","validation"],"backgroundTag":"missing-required-config-field","analyzedSha":"affd8760f44190dbdfbec23403f4c4b642c33112","analyzedAt":"2026-09-09T21:28:12.402Z","contentChangedAt":"2026-09-09T21:28:12.402Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}