tonhowtf/omniget · error

o envio é público e vale para todo mundo: confirme antes

Error message

o envio é público e vale para todo mundo: confirme antes

What it means

submit refuses to run unless SubmitOptions.confirmed is true. SponsorBlock submissions are public and affect every viewer of the video, so the library makes an explicit confirmation flag a hard gate rather than an implicit default.

Solutions

  1. Set confirmed: true only after the user explicitly approves the submission in the UI.
  2. Show a confirmation dialog before calling submit and pass its result through.
  3. If the error appears despite user confirmation, check you are constructing SubmitOptions with the field set (not relying on a Default).
  4. In automated tests, construct SubmitOptions with confirmed: true explicitly.

Example fix

// before
submit(SubmitOptions { url, segments, ..Default::default() }).await?; // confirmed: false
// after
if confirm_dialog("Publicar no SponsorBlock?")? {
    submit(SubmitOptions { url, segments, confirmed: true, .. }).await?;
}
Defensive patterns

Strategy: try-catch

Validate before calling

if !opts.confirmed {
    return Err(anyhow!("confirme o envio antes de chamar submit"));
}

Try / catch

match submit(opts).await {
    Err(e) if e.to_string().contains("confirme antes") => show_confirmation_dialog_then_retry(),
    other => other?,
}

Prevention

When it happens

Trigger: Calling submit with SubmitOptions { confirmed: false, .. } — i.e. any programmatic submission that did not go through a user confirmation step.

Common situations: Testing the submit function with a default-constructed options struct; forgetting to wire the UI confirmation dialog's result into the confirmed field; batch scripts submitting without any user interaction.

Related errors


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

Appendix: source

Thrown at src-tauri/omniget-core/src/core/tools/sponsorblock.rs:340

pub fn submit_error(status: u16, body: &str) -> String {
    let corpo = body.trim();
    let curto = if corpo.len() > 200 {
        &corpo[..200]
    } else {
        corpo
    };
    match status {
        400 => format!("o SponsorBlock recusou o envio: {}", curto),
        403 => format!("envio bloqueado pelo SponsorBlock: {}", curto),
        409 => "esse trecho já tinha sido enviado".to_string(),
        429 => "muitos envios seguidos; espere alguns minutos e tente de novo".to_string(),
        _ => format!("SponsorBlock: HTTP {} {}", status, curto),
    }
}

pub async fn submit(opts: SubmitOptions) -> anyhow::Result<SubmitResult> {
    if !opts.confirmed {
        return Err(anyhow!(
            "o envio é público e vale para todo mundo: confirme antes"
        ));
    }
    let id = video_id(&opts.url)
        .ok_or_else(|| anyhow!("nao reconheci um video do YouTube em: {}", opts.url))?;
    let user = local_user_id()?;
    let body = build_payload(&id, &user, opts.video_duration, &opts.segments)?;

    let client = super::client()?;
    let resp = client
        .post(format!("{}/api/skipSegments", SERVER))
        .json(&body)
        .send()
        .await?;
    let status = resp.status().as_u16();
    let text = resp.text().await.unwrap_or_default();
    if !(200..300).contains(&status) {
        return Err(anyhow!("{}", submit_error(status, &text)));

View on GitHub (pinned to 8600b91f42)