{"record":{"id":"0a7d5cb6271e0994","repo":"BigPizzaV3/CodexPlusPlus","slug":"key-toml-table","errorCode":null,"errorMessage":"{key} 必须是 TOML table","messagePattern":"(.+?) 必须是 TOML table","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/codex-plus-core/src/relay_config.rs","lineNumber":165,"sourceCode":"    if enabled {\n        if !updated.is_empty() {\n            updated.push_str(\"\\n\\n\");\n        }\n        updated.push_str(\"[features]\\ngoals = true\");\n    }\n    ensure_trailing_newline(updated)\n}\n\nfn table_mut_or_insert<'a>(doc: &'a mut DocumentMut, key: &str) -> anyhow::Result<&'a mut Table> {\n    if !doc.as_table().contains_key(key) {\n        doc[key] = toml_edit::table();\n    }\n    if doc.get(key).and_then(Item::as_table).is_none() {\n        doc[key] = toml_edit::table();\n    }\n    doc.get_mut(key)\n        .and_then(Item::as_table_mut)\n        .ok_or_else(|| anyhow::anyhow!(\"{key} 必须是 TOML table\"))\n}\n\nfn table_mut_if_exists<'a>(doc: &'a mut DocumentMut, key: &str) -> Option<&'a mut Table> {\n    doc.get_mut(key).and_then(Item::as_table_mut)\n}\n\npub fn relay_status_from_home(home: &Path) -> RelayStatus {\n    let auth = chatgpt_auth_status_from_home(home);\n    let config = relay_config_status_from_home(home);\n    RelayStatus {\n        authenticated: auth.authenticated,\n        auth_source: auth.source,\n        account_label: auth.account_label,\n        config_path: config.config_path,\n        configured: config.configured,\n        requires_openai_auth: config.requires_openai_auth,\n        has_bearer_token: config.has_bearer_token,\n    }","sourceCodeStart":147,"sourceCodeEnd":183,"githubUrl":"https://github.com/BigPizzaV3/CodexPlusPlus/blob/fb3ebd9a82383aedd8d098aa9ae3aef9426d13a4/crates/codex-plus-core/src/relay_config.rs#L147-L183","documentation":"Generic guard in table_mut_or_insert (relay_config.rs): fired when a key being edited in config.toml (via set_codex_goals_feature_in_home, merge_common_config_into_config or ensure_provider_table) exists as a non-table value, so nested keys cannot be written. The offending input is the scalar/array value under that key in config.toml.","triggerScenarios":"Thrown at crates/codex-plus-core/src/relay_config.rs:165 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix config.toml so the key is a proper [table] section","Delete the conflicting scalar and re-apply the relay profile","Regenerate config.toml via Codex++ apply instead of hand-editing"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"fb3ebd9a82383aedd8d098aa9ae3aef9426d13a4","analyzedAt":"2026-08-17T11:35:12.031Z","contentChangedAt":"2026-08-17T11:35:12.031Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}