tonhowtf/omniget · error

tipo desconhecido: {}

Error message

tipo desconhecido: {}

What it means

publish_web dispatches on a media type tag and only handles the known variants (e.g. single image, video, sidecar/carousel). If the request carries a type string that does not match any implemented branch, the fallthrough arm rejects it with "tipo desconhecido: <type>". It is an internal/forward-compatibility guard: the type value was either typoed, newly added, or produced by a caller not synchronized with this switch.

Solutions

  1. Check the type value in the PublishRequest against the variants matched in publish_web's match expression and use one of the supported ones
  2. Add a new arm to the match in publish_web implementing the missing media type, or map it to an existing one
  3. Log/serialize the full request on failure to confirm what type string actually arrived (whitespace/case differences)

Example fix

// before
let req = PublishRequest { media_type: "reel".into(), .. };
publish_web(&req).await?; // Err: tipo desconhecido: reel
// after
let req = PublishRequest { media_type: "video".into(), .. };
publish_web(&req).await?;
Defensive patterns

Strategy: validation

Validate before calling

const SUPPORTED: &[&str] = &["image", "video", "sidecar"];
if !SUPPORTED.contains(&req.media_type.as_str()) {
    return Err(format!("tipo de mídia não suportado: {}", req.media_type));
}

Type guard

fn is_supported_media_type(t: &str) -> bool {
    matches!(t, "image" | "video" | "sidecar")
}

Prevention

When it happens

Trigger: Calling publish_web (publish_web entry in src-tauri/omniget-core/src/core/tools/instagram/publish.rs) with a PublishRequest whose media type string is not one of the explicitly matched variants — e.g. type="reel" or "story" when only "image"/"video"/"sidecar" are implemented, or an empty/unset type.

Common situations: Frontend sends a new media kind the Rust backend has not implemented yet; typo in the type field; deserialization defaults the type field when JSON omits it; version mismatch between app frontend and bundled core.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


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

Appendix: source

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

                    children.push(serde_json::json!({"upload_id": uid, "source_type": "library"}));
                }
                super::sleep_jitter(500, 1500).await;
            }
            report("configure", total - 1, total);
            let mut form = common_form(req, &sidecar_id);
            form.push(("client_sidecar_id", sidecar_id.clone()));
            form.push((
                "children_metadata",
                serde_json::to_string(&children).unwrap_or_default(),
            ));
            let json = client
                .post_form("/api/v1/media/configure_sidecar/", &form)
                .await
                .map_err(m)?;
            report("done", total, total);
            Ok(result_of(&json))
        }
        other => Err(anyhow!("tipo desconhecido: {}", other)),
    }
}

// ── API oficial (Graph) ──────────────────────────────────────────────────

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
pub struct GraphAuth {
    pub access_token: String,
    pub ig_user_id: String,
}

const GRAPH: &str = "https://graph.facebook.com/v21.0";

async fn graph_post(
    http: &reqwest::Client,
    url: &str,
    form: &[(&str, String)],
) -> anyhow::Result<Value> {

View on GitHub (pinned to 8600b91f42)