{"record":{"id":"42449e084ddae4e9","repo":"BigPizzaV3/CodexPlusPlus","slug":"id-42449e","errorCode":null,"errorMessage":"上下文 id 不能为空","messagePattern":"上下文 id 不能为空","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/codex-plus-core/src/relay_config.rs","lineNumber":1039,"sourceCode":") -> anyhow::Result<CodexContextEntries> {\n    let normalized = normalize_duplicate_toml_text(common_config);\n    let doc = parse_toml_document(&normalized)?;\n    Ok(CodexContextEntries {\n        mcp_servers: list_context_entries_for_table(&doc, \"mcp_servers\"),\n        skills: list_context_entries_for_table(&doc, \"skills\"),\n        plugins: list_context_entries_for_table(&doc, \"plugins\"),\n    })\n}\n\npub fn upsert_context_entry_in_common_config(\n    common_config: &str,\n    kind: &str,\n    id: &str,\n    toml_body: &str,\n) -> anyhow::Result<String> {\n    let id = id.trim();\n    if id.is_empty() {\n        anyhow::bail!(\"上下文 id 不能为空\");\n    }\n    let table_name = context_table_name(kind)?;\n    let body_doc = parse_toml_document(toml_body)?;\n    let normalized = normalize_duplicate_toml_text(common_config);\n    let mut doc = parse_toml_document(&normalized)?;\n    if !doc.as_table().contains_key(table_name) {\n        doc[table_name] = toml_edit::table();\n    }\n    if doc[table_name].as_table().is_none() {\n        anyhow::bail!(\"{table_name} 必须是 TOML 表\");\n    }\n    doc[table_name][id] = Item::Table(body_doc.as_table().clone());\n    Ok(normalize_optional_toml(doc))\n}\n\npub fn delete_context_entry_from_common_config(\n    common_config: &str,\n    kind: &str,","sourceCodeStart":1021,"sourceCodeEnd":1057,"githubUrl":"https://github.com/BigPizzaV3/CodexPlusPlus/blob/b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6/crates/codex-plus-core/src/relay_config.rs#L1021-L1057","documentation":"upsert_context_entry_in_common_config inserts an entry under an [table] section of the common config.toml; the entry id is trimmed and must be non-empty because it becomes a TOML key. Empty ids would produce invalid or meaningless entries, so they are rejected first.","triggerScenarios":"Calling upsert_context_entry_in_common_config(kind, id, toml_body, common_config) with id == \"\" or whitespace.","commonSituations":"A UI form where the context/profile name field was left blank; programmatic callers building entries from data where the identifier field was missing.","solutions":["Provide a non-empty id (the TOML key for the entry) before calling","Validate the id field in the caller/UI prior to invoking this function","Generate a default id from other fields if the user leaves it blank"],"exampleFix":"// before\nupsert_context_entry_in_common_config(\"mcp_servers\", \"  \", body, config)?;\n// after\nupsert_context_entry_in_common_config(\"mcp_servers\", \"my-server\", body, config)?;","handlingStrategy":"validation","validationCode":"if id.trim().is_empty() {\n    return Err(anyhow::anyhow!(\"上下文 id 不能为空\"));\n}","typeGuard":null,"tryCatchPattern":"match upsert_context_entry_in_common_config(kind, &id, &body, config) {\n    Err(e) if e.to_string().contains(\"上下文 id 不能为空\") => request_entry_name_from_user(),\n    other => other?,\n}","preventionTips":["Make the id field required in the entry form","Auto-derive an id slug from the entry's name/command if blank","Reject whitespace-only ids at the UI layer"],"tags":["validation","toml","empty-field"],"backgroundTag":"empty-required-field","analyzedSha":"b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6","analyzedAt":"2026-09-19T23:35:21.129Z","contentChangedAt":"2026-09-19T23:35:21.129Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}