tonhowtf/omniget · error

criar perfil

Error message

criar perfil: {}

What it means

clone_speak POSTs multipart data to {base}/profiles to create a voice profile and calls error_for_status(); any non-success HTTP status is wrapped as 'criar perfil: {}' (create profile: {}). It means the VoiceStudio server rejected the profile-creation request.

Solutions

  1. Read the wrapped reqwest error for the status code; 401/403 → fix credentials, 400/422 → fix form fields.
  2. Verify the API key and base URL used by the client.
  3. Check the sample audio is a supported format and reasonable size before upload.
  4. Rename or reuse the profile if the server rejects duplicates.
  5. Retry with backoff on 429/5xx and check service health.
Defensive patterns

Strategy: try-catch

Validate before calling

// Verify auth and non-duplicate name before POST /profiles
let probe = client.get(format!("{}/profiles", base)).send().await?;
if !probe.status().is_success() {
    return Err(format!("profile API unavailable: {}", probe.status()));
}

Try / catch

match create_result {
    Err(e) if e.to_string().contains("criar perfil") => {
        let s = e.to_string();
        if s.contains("401") || s.contains("403") { /* fix credentials */ }
        else if s.contains("409") || s.contains("402") { /* duplicate name: pick another save_as */ }
        else if s.contains("413") { /* sample too large: trim/convert audio */ }
        else { /* retry with backoff or surface error */ }
    }
    other => other?,
}

Prevention

When it happens

Trigger: The POST /profiles call returns 4xx/5xx: missing or invalid auth, a sample audio format the server rejects, duplicate profile name, or malformed multipart form.

Common situations: Invalid API token, uploading a sample in an unsupported codec, a profile name that already exists server-side, or VoiceStudio quota exhausted.

Understand the failure class

Background: "API error: {status}" and "HTTP 401/403/404/429/5xx" errors: non-2xx HTTP responses explained — this error's family across 27 libraries.

Related errors


AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12). Data as JSON: /api/errors/34cd13a0f9829ec0. Report an issue: GitHub.

Appendix: source

Thrown at src-tauri/omniget-core/src/core/tools/voicestudio.rs:311

            .text(
                "language",
                if opts.language.is_empty() {
                    "Auto".to_string()
                } else {
                    opts.language.clone()
                },
            )
            .part(
                "ref_audio",
                reqwest::multipart::Part::bytes(sample).file_name(file_name),
            );
        let j: serde_json::Value = c
            .post(format!("{}/profiles", b))
            .multipart(form)
            .send()
            .await?
            .error_for_status()
            .map_err(|e| anyhow!("criar perfil: {}", e))?
            .json()
            .await?;
        profile_id = j
            .get("id")
            .or_else(|| j.get("profile_id"))
            .and_then(|v| v.as_str())
            .map(String::from);
    }
    super::report(&progress, "voicestudio", "generate", 0, None, None);
    let mut form = reqwest::multipart::Form::new()
        .text("text", opts.text.clone())
        .text("speed", opts.speed.to_string())
        .text("stream", "false");
    if !opts.language.is_empty() {
        form = form.text("language", opts.language.clone());
    }
    if let Some(pid) = &profile_id {
        form = form.text("profile_id", pid.clone());

View on GitHub (pinned to 8600b91f42)