{"record":{"id":"95cf9463641eb0f5","repo":"Hmbown/CodeWhale","slug":"use-either-clone-voice-or-voice-for-cloned-voi","errorCode":null,"errorMessage":"Use either --clone-voice or --voice for cloned voice data, not both","messagePattern":"Use either --clone-voice or --voice for cloned voice data, not both","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/tui/src/lib.rs","lineNumber":7818,"sourceCode":"        json: json_output,\n    } = args;\n\n    if config.api_provider() != ApiProvider::XiaomiMimo {\n        bail!(\n            \"`speech` requires provider = \\\"xiaomi-mimo\\\" (current: {}). Run with `--provider xiaomi-mimo` or set it in config.\",\n            config.api_provider().as_str()\n        );\n    }\n\n    if text.trim().is_empty() {\n        bail!(\"Speech text cannot be empty\");\n    }\n    let voice_is_data_uri = voice\n        .as_deref()\n        .map(str::trim)\n        .is_some_and(|value| value.starts_with(\"data:audio/\"));\n    if clone_voice.is_some() && voice.is_some() {\n        bail!(\"Use either --clone-voice or --voice for cloned voice data, not both\");\n    }\n    let model = infer_speech_model(\n        model.as_deref(),\n        clone_voice.is_some() || voice_is_data_uri,\n        voice_prompt.is_some(),\n    );\n    let model_lower = model.to_ascii_lowercase();\n    if !model_lower.contains(\"tts\") {\n        bail!(\n            \"speech requires a TTS model (examples: {}); got {model}\",\n            SPEECH_MODEL_EXAMPLES.join(\", \")\n        );\n    }\n    let is_voice_design = model_lower.contains(\"voicedesign\");\n    let is_voice_clone = model_lower.contains(\"voiceclone\");\n\n    let instruction = combine_speech_instructions(instruction, voice_prompt);\n    if is_voice_design","sourceCodeStart":7800,"sourceCodeEnd":7836,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/lib.rs#L7800-L7836","documentation":"The speech subcommand accepts cloned-voice audio either as --clone-voice (a file path) or as --voice (a data:audio/ URI); supplying both is ambiguous, so it bails. Exactly one voice-source mechanism must be used.","triggerScenarios":"Running `speech` with both --clone-voice <path> and --voice <data-uri> set (clone_voice.is_some() && voice.is_some()).","commonSituations":"Scripts that append --voice conditionally while --clone-voice is already present; combining an old command line with a new flag; documentation examples copied together.","solutions":["Remove either --clone-voice or --voice, keeping only one voice source","If you have a file, use --clone-voice; if you already have a data URI, use --voice","Fix scripts so the voice-source flag is set in exactly one branch"],"exampleFix":"// before\ncodewhale speech --clone-voice sample.wav --voice \"data:audio/wav;base64,...\"\n// after\ncodewhale speech --clone-voice sample.wav","handlingStrategy":"validation","validationCode":"if clone_voice.is_some() && voice.is_some() {\n    eprintln!(\"use either --clone-voice or --voice, not both\");\n    std::process::exit(2);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Choose one voice-source flag per invocation: file path -> --clone-voice, data URI -> --voice","Build speech command lines programmatically so only one flag branch runs","Avoid copy-pasting example commands that each use a different flag"],"tags":["cli","speech","conflicting-flags"],"backgroundTag":"mutually-exclusive-options","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}