tonhowtf/omniget · error · anyhow

informe o client_id da sua app do Trakt

Error message

informe o client_id da sua app do Trakt

What it means

trakt::save_app validates that after applying the provided client_id/client_secret, the stored credentials contain a non-empty client_id. The Trakt API application registration requires a client_id, so saving without one is rejected before anything is written.

Solutions

  1. Create a Trakt application at https://trakt.tv/oauth/applications and copy its client_id
  2. Pass the client_id string as the id argument to save_app (non-empty)
  3. Check the input field is not blank — trim accidental whitespace-only input before calling
  4. If a client_id was previously saved, confirm the credentials file loads (see 'sem pasta de dados' error if it does not)

Example fix

// before
trakt::save_app("", "some-secret")?;
// after
trakt::save_app("abc123def456clientid", "some-secret")?;
Defensive patterns

Strategy: validation

Validate before calling

let id = id.trim().to_string();
if id.is_empty() {
    return Err("preencha o client_id da app do Trakt antes de salvar");
}

Try / catch

match trakt::save_app(&id, &secret) {
    Err(e) if e.to_string().contains("client_id") => {
        eprintln!("crie uma app em trakt.tv/oauth/applications e cole o client_id");
    }
    other => other?,
}

Prevention

When it happens

Trigger: Calling save_app with an empty or whitespace-only id argument and no previously stored client_id (or the stored credentials failed to load), so c.client_id remains empty after merging the arguments.

Common situations: User opened the Trakt settings dialog and submitted without pasting the client_id; the Trakt app was never created on trakt.tv so there is no client_id to paste; a previously saved client_id was cleared and save_app called with empty args expecting the old value.

Understand the failure class

Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.

Related errors


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

Appendix: source

Thrown at src-tauri/omniget-core/src/core/tools/lists/trakt.rs:128

    let _g = LOCK.lock().unwrap_or_else(|e| e.into_inner());
    let mut c = load();
    let id = client_id.trim();
    let secret = client_secret.trim();
    if !id.is_empty() && id != c.client_id {
        // Trocou de app: o token antigo não vale mais.
        c.access_token.clear();
        c.refresh_token.clear();
        c.expires_at = 0;
        c.username.clear();
    }
    if !id.is_empty() {
        c.client_id = id.to_string();
    }
    if !secret.is_empty() {
        c.client_secret = secret.to_string();
    }
    if c.client_id.is_empty() {
        return Err(anyhow!("informe o client_id da sua app do Trakt"));
    }
    store(&c)?;
    Ok(c.view())
}

pub fn disconnect() -> Result<CredsView> {
    let _g = LOCK.lock().unwrap_or_else(|e| e.into_inner());
    let mut c = load();
    c.access_token.clear();
    c.refresh_token.clear();
    c.expires_at = 0;
    c.username.clear();
    store(&c)?;
    Ok(c.view())
}

/// Apaga tudo, inclusive as credenciais da app.
pub fn forget() -> Result<CredsView> {

View on GitHub (pinned to 8600b91f42)