{"record":{"id":"978d11e5f2724250","repo":"BigPizzaV3/CodexPlusPlus","slug":"other-978d11","errorCode":null,"errorMessage":"未知上下文类型：{other}","messagePattern":"未知上下文类型：(.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/codex-plus-core/src/relay_config.rs","lineNumber":2643,"sourceCode":"                toml_body: body,\n                enabled: context_entry_enabled(table),\n            })\n        })\n        .collect()\n}\n\nfn table_body_to_string(table: &Table) -> String {\n    let mut doc = DocumentMut::new();\n    merge_toml_table_like(doc.as_table_mut(), table);\n    normalize_optional_toml(doc)\n}\n\nfn context_table_name(kind: &str) -> anyhow::Result<&'static str> {\n    match kind {\n        \"mcp\" | \"mcpServer\" | \"mcpServers\" => Ok(\"mcp_servers\"),\n        \"skill\" | \"skills\" => Ok(\"skills\"),\n        \"plugin\" | \"plugins\" => Ok(\"plugins\"),\n        other => anyhow::bail!(\"未知上下文类型：{other}\"),\n    }\n}\n\nfn context_kind_name(table: &str) -> &'static str {\n    match table {\n        \"mcp_servers\" => \"mcp\",\n        \"skills\" => \"skill\",\n        \"plugins\" => \"plugin\",\n        _ => \"unknown\",\n    }\n}\n\nfn context_entry_summary(body: &str) -> String {\n    body.lines()\n        .map(str::trim)\n        .find(|line| !line.is_empty() && !line.starts_with('#'))\n        .unwrap_or(\"\")\n        .chars()","sourceCodeStart":2625,"sourceCodeEnd":2661,"githubUrl":"https://github.com/BigPizzaV3/CodexPlusPlus/blob/b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6/crates/codex-plus-core/src/relay_config.rs#L2625-L2661","documentation":"context_table_name maps a context kind string (\"mcp\", \"skill\", \"plugin\", and plural variants) to its backing table name; any other kind is rejected with this error. It is an allowlist: only MCP servers, skills, and plugins are supported context types for this operation.","triggerScenarios":"Calling the context-related command/lookup with kind values other than mcp/mcpServer/mcpServers/skill/skills/plugin/plugins — e.g. \"extension\", \"tool\", \"agent\", or an empty string. (Note: commands.rs:5821 has a similar error '未知配置文件类型' for config file types \"config\"/\"auth\"; do not confuse the two.)","commonSituations":"A UI or script passes a new/unfamiliar context category added by a newer Codex version that this build doesn't know; a typo like \"mcpserver\" or \"Skill\" (case-sensitive match); passing a config-file type where a context kind is expected.","solutions":["Use one of the supported kinds: \"mcp\", \"skill\", or \"plugin\" (or their plurals)","Fix casing/typos — matching is exact (\"mcpServer\", not \"MCP\" or \"mcpserver\")","If a new context type is genuinely needed, add it to the match in context_table_name","Confirm you are calling the context API, not the config-file API, with this string"],"exampleFix":"// before\nawait listContext(\"tools\")\n// after\nawait listContext(\"plugins\")","handlingStrategy":"validation","validationCode":"const KINDS = new Set(['mcp','mcpServer','mcpServers','skill','skills','plugin','plugins']);\nif (!KINDS.has(kind)) throw new Error(`unsupported context kind: ${kind}`);","typeGuard":"const isContextKind = (k) => ['mcp','mcpServer','mcpServers','skill','skills','plugin','plugins'].includes(k);","tryCatchPattern":"try { await listContext(kind); } catch (e) { if (String(e).includes('未知上下文类型')) { console.error(`Use mcp/skill/plugin, got: ${kind}`); } else throw e; }","preventionTips":["Keep a constant list of allowed context kinds in callers","Normalize kind casing/singular-plural before calling","Don't confuse context kinds with config file types (config/auth)"],"tags":["validation","invalid-argument"],"backgroundTag":"invalid-enum-value","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"}