tonhowtf/omniget · error

o arquivo nao e publico; abra no navegador e use Arquivo >…

Error message

o arquivo nao e publico; abra no navegador e use Arquivo > Fazer download

What it means

After sending the GET to the Google Docs export URL, download() maps HTTP 401/403 to this user-facing error. Google returns these statuses when the file is not shared publicly (the exporter requires no-auth access), so the tool cannot download it without a browser session.

Solutions

  1. Open the file in a browser and share it as 'Anyone with the link' (viewer is enough), then retry
  2. Alternatively download manually via Arquivo > Fazer download as the message suggests
  3. Verify the URL is for a public file and not an internal Workspace-only doc
Defensive patterns

Strategy: try-catch

Try / catch

match gdocs::download(&url, format).await {
    Err(e) if e.to_string().contains("nao e publico") => {
        eprintln!("Arquivo privado: compartilhe como 'Qualquer pessoa com o link' e tente novamente.");
    }
    Err(e) => eprintln!("falha: {e}"),
    Ok(path) => println!("baixado: {path}"),
}

Prevention

When it happens

Trigger: Calling download() on a Google Docs URL whose sharing is restricted: the file is private, shared only with specific accounts, or belongs to an organization requiring login; Google's export endpoint responds 401 or 403.

Common situations: Company Workspace files not shared 'Anyone with the link'; a personal Drive file after permission changes; links copied from an internal doc; shared-drive files requiring authenticated session.

Understand the failure class

Background: Permission denied / not authorized / 403 Forbidden: access-control rejections when the caller lacks the required role, grant, or ownership — this error's family across 18 libraries.

Related errors


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

Appendix: source

Thrown at src-tauri/omniget-core/src/core/tools/gdocs.rs:75

    format: &str,
    dest_dir: &str,
    progress: super::ProgressFn,
) -> anyhow::Result<String> {
    let info = parse(url).ok_or_else(|| {
        anyhow!("cole um link de docs.google.com (Documentos, Apresentações ou Planilhas)")
    })?;
    if !info.formats.iter().any(|f| f == format) {
        return Err(anyhow!(
            "formato {} nao disponivel para {}",
            format,
            info.kind
        ));
    }
    let client = super::client()?;
    let export = export_url(&info, format);
    let resp = client.get(&export).send().await?;
    if resp.status().as_u16() == 401 || resp.status().as_u16() == 403 {
        return Err(anyhow!(
            "o arquivo nao e publico; abra no navegador e use Arquivo > Fazer download"
        ));
    }
    if !resp.status().is_success() {
        return Err(anyhow!("Google Docs: HTTP {}", resp.status()));
    }
    let name = resp
        .headers()
        .get(reqwest::header::CONTENT_DISPOSITION)
        .and_then(|v| v.to_str().ok())
        .and_then(filename_from_disposition)
        .unwrap_or_else(|| format!("{}.{}", info.id, format));
    let dir = PathBuf::from(dest_dir);
    std::fs::create_dir_all(&dir)?;
    let dest = dir.join(super::sanitize_name(&name));
    let bytes = resp.bytes().await?;
    tokio::fs::write(&dest, &bytes).await?;
    super::report(

View on GitHub (pinned to 8600b91f42)