tonhowtf/omniget · error

informe um link, uma legenda ou um arquivo de mídia

Error message

informe um link, uma legenda ou um arquivo de mídia

What it means

In yt_notes.rs `run`, the tool requires at least one input source: a URL, an existing subtitle/caption input, or a media file for Whisper transcription. If none of these was supplied (or the branches that would populate `cues`/`source` were not taken), it fails fast with this Portuguese message instead of proceeding with empty input. It is a guard against running the transcription pipeline with nothing to process.

Solutions

  1. Set `opts.url` to a valid YouTube (or other supported) video link before calling run.
  2. Provide a subtitle/caption file input when no link is available.
  3. Provide a local media file so the Whisper branch can transcribe it.
  4. In the caller/UI, validate that at least one of link/caption/media is present before invoking the tool.

Example fix

// before
let opts = YtNotesOptions::default(); // no url, no media, no captions
run(opts).await?;
// after
let opts = YtNotesOptions { url: "https://www.youtube.com/watch?v=abc".into(), ..Default::default() };
run(opts).await?;
Defensive patterns

Strategy: validation

Validate before calling

if opts.url.trim().is_empty() && opts.media_path.is_none() && opts.subtitle_path.is_none() {
    return Err("provide a link, a caption or a media file before running yt-notes");
}
run(opts).await?;

Type guard

fn has_source(opts: &YtNotesOptions) -> bool {
    !opts.url.trim().is_empty() || opts.media_path.is_some() || opts.subtitle_path.is_some()
}

Prevention

When it happens

Trigger: Calling `run` with an Options struct where `opts.url` is empty/whitespace, no subtitle file was given, and no media path was provided (the final `else` branch of the source-selection if/else chain).

Common situations: A GUI/frontend invokes the yt-notes tool with only a title or topic but no link; a test or script builds options forgetting to set the url field; a user clears the link field but leaves the media/subtitle inputs empty.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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

Appendix: source

Thrown at src-tauri/omniget-core/src/core/tools/yt_notes.rs:515

                ))
            }
            Err(e) => return Err(e),
        }
    } else if !opts.media_path.trim().is_empty() {
        let path = std::path::PathBuf::from(opts.media_path.trim());
        let r = transcribe(&path, &opts, progress.clone()).await?;
        if meta.title.is_empty() {
            meta.title = path
                .file_stem()
                .map(|s| s.to_string_lossy().to_string())
                .unwrap_or_default();
        }
        meta.language = r.language.clone();
        meta.duration_seconds = r.seconds;
        cues = r.cues;
        source = "whisper".to_string();
    } else {
        return Err(anyhow!(
            "informe um link, uma legenda ou um arquivo de mídia"
        ));
    }

    if cues.is_empty() {
        return Err(anyhow!("a transcrição saiu vazia"));
    }
    super::report(&progress, ID, "progress", 4, Some(4), None);
    let chapters = if opts.use_chapters {
        meta.chapters.clone()
    } else {
        Vec::new()
    };
    let boundaries: Vec<i64> = chapters.iter().map(|c| c.start_ms).collect();
    let paragraphs = stitch_at(&cues, &boundaries, &opts.stitch);
    let doc = NotesDoc {
        title: meta.title.clone(),
        channel: meta.channel.clone(),

View on GitHub (pinned to 8600b91f42)