tonhowtf/omniget · error

a API oficial so aceita URLs publicas (https://…) para os…

Error message

a API oficial so aceita URLs publicas (https://…) para os arquivos

What it means

The official Graph API cannot fetch files from the local disk or app storage; publish_graph therefore requires every entry in req.files to be a public http(s) URL. If the list is empty or any file fails the starts_with("http") check, it raises "a API oficial so aceita URLs publicas (https://…) para os arquivos". This is a preflight validation of the publish payload.

Solutions

  1. Upload the files to a publicly reachable HTTPS URL (CDN, object storage) and pass those URLs in req.files
  2. Use publish_web instead when the source files are local, since it uploads them directly
  3. Validate the file list before calling: non-empty and every entry starts with https://

Example fix

// before
let req = PublishRequest { files: vec!["/tmp/media/a.jpg".into()], .. };
publish_graph(&auth, &req).await?; // Err
// after
let req = PublishRequest { files: vec!["https://cdn.example.com/a.jpg".into()], .. };
publish_graph(&auth, &req).await?;
Defensive patterns

Strategy: validation

Validate before calling

let all_public = !req.files.is_empty()
    && req.files.iter().all(|f| f.starts_with("https://"));
if !all_public {
    return Err("todos os arquivos precisam de URLs públicas https://");
}

Type guard

fn all_files_are_public_urls(files: &[String]) -> bool {
    !files.is_empty() && files.iter().all(|f| f.starts_with("http"))
}

Prevention

When it happens

Trigger: publish_graph called with req.files empty, or any path like "/home/user/pics/a.jpg", "file:///...", a bare "data:" URI, or a local relative path among the files.

Common situations: Caller reuses the web-publish flow that consumes local downloaded files and passes the same paths to the Graph flow; download-first pipeline hands local temp paths instead of hosted URLs; forgot to upload assets to a CDN/public host first.

Understand the failure class

Background: "Invalid URL" errors: why new URL(), URI.parse, and reqwest::Url reject your string — missing scheme, whitespace, and bad path format — this error's family across 39 libraries.

Related errors


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

Appendix: source

Thrown at src-tauri/omniget-core/src/core/tools/instagram/publish.rs:606

    Err(anyhow!("o Instagram demorou demais para processar a midia"))
}

/// Publica pela API oficial. `req.files` são URLs públicas.
pub async fn publish_graph(
    auth: &GraphAuth,
    req: &PublishRequest,
    progress: &super::super::ProgressFn,
    job: &str,
) -> anyhow::Result<PublishResult> {
    let id = format!("ig:{}", job);
    let http = super::super::client()?;
    let token = auth.access_token.trim().to_string();
    let user = auth.ig_user_id.trim().to_string();
    if token.is_empty() || user.is_empty() {
        return Err(anyhow!("informe o token e o ID da conta do Instagram"));
    }
    if req.files.is_empty() || !req.files.iter().all(|f| f.starts_with("http")) {
        return Err(anyhow!(
            "a API oficial so aceita URLs publicas (https://…) para os arquivos"
        ));
    }
    let media_url = format!("{}/{}/media", GRAPH, user);
    let is_video = |f: &str| {
        f.split('?')
            .next()
            .unwrap_or(f)
            .to_lowercase()
            .ends_with(".mp4")
            || f.to_lowercase().ends_with(".mov")
    };
    let creation_id = match req.kind.as_str() {
        "carousel" => {
            let total = req.files.len() as u64 + 2;
            let mut children = Vec::new();
            for (i, f) in req.files.iter().enumerate() {
                super::super::report(progress, &id, "container", i as u64, Some(total), None);

View on GitHub (pinned to 8600b91f42)