{"record":{"id":"70ba9f7371b68fa7","repo":"BigPizzaV3/CodexPlusPlus","slug":"other","errorCode":null,"errorMessage":"未知配置文件类型：{other}","messagePattern":"未知配置文件类型：(.+?)","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"apps/codex-plus-manager/src-tauri/src/commands.rs","lineNumber":5821,"sourceCode":"    let config_path = home.join(\"config.toml\");\n    let auth_path = home.join(\"auth.json\");\n    Ok(RelayFilesPayload {\n        config_path: config_path.to_string_lossy().to_string(),\n        auth_path: auth_path.to_string_lossy().to_string(),\n        config_contents: read_optional_text_file(&config_path)?,\n        auth_contents: read_optional_text_file(&auth_path)?,\n    })\n}\n\nfn save_relay_file_in_home(\n    home: &std::path::Path,\n    kind: &str,\n    contents: &str,\n) -> anyhow::Result<()> {\n    let path = match kind {\n        \"config\" => home.join(\"config.toml\"),\n        \"auth\" => home.join(\"auth.json\"),\n        other => anyhow::bail!(\"未知配置文件类型：{other}\"),\n    };\n    if let Some(parent) = path.parent() {\n        std::fs::create_dir_all(parent)?;\n    }\n    std::fs::write(path, contents)?;\n    Ok(())\n}\n\nfn prepare_relay_file_contents(\n    kind: &str,\n    contents: &str,\n    profile: &RelayProfile,\n) -> anyhow::Result<String> {\n    if kind == \"config\" {\n        return codex_plus_core::relay_config::apply_deepseek_responses_compatibility(\n            profile, contents,\n        );\n    }","sourceCodeStart":5803,"sourceCodeEnd":5839,"githubUrl":"https://github.com/BigPizzaV3/CodexPlusPlus/blob/b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6/apps/codex-plus-manager/src-tauri/src/commands.rs#L5803-L5839","documentation":"A write-config helper accepts only the literal kinds \"config\" (writes config.toml) and \"auth\" (writes auth.json) inside the codex home. Any other kind string hits the catch-all match arm and bails with the unsupported type name interpolated into the message.","triggerScenarios":"Invoking the config-writing command (commands.rs ~5821) with kind set to anything other than \"config\" or \"auth\", e.g. a typo like \"config.toml\", \"settings\", or a lowercased/uppercased variant.","commonSituations":"Test helper or IPC caller passes a wrong kind string; a refactor renamed kinds without updating call sites; dynamic kind computed from user input or a file extension.","solutions":["Pass exactly \"config\" to write config.toml or \"auth\" to write auth.json","Fix typos/normalization at the call site (trim + lowercase, strip extensions)","If a new file kind is genuinely needed, add a match arm for it in the helper"],"exampleFix":"// before\nwrite_config_file(\"config.toml\", contents);\n// after\nwrite_config_file(\"config\", contents);","handlingStrategy":"validation","validationCode":"const KINDS = ['config', 'auth']; if (!KINDS.includes(kind)) throw new Error(`kind must be config or auth, got ${kind}`);","typeGuard":"const isConfigKind = (k: string): k is 'config' | 'auth' => k === 'config' || k === 'auth';","tryCatchPattern":"try { await writeConfigFile(kind, contents) } catch (e) { if (String(e).includes('未知配置文件类型')) console.error('bad kind:', kind); }","preventionTips":["Type the kind parameter as a union 'config' | 'auth'","Centralize kind constants instead of inline strings","Normalize (trim/lowercase) user-provided kind values"],"tags":["config","invalid-argument","tauri"],"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"}