{"record":{"id":"a78cc5c4b433bef4","repo":"tonhowtf/omniget","slug":"informe-o-client-id-da-sua-app-do-trakt","errorCode":null,"errorMessage":"informe o client_id da sua app do Trakt","messagePattern":"informe o client_id da sua app do Trakt","errorType":"validation","errorClass":"anyhow","httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/core/tools/lists/trakt.rs","lineNumber":128,"sourceCode":"    let _g = LOCK.lock().unwrap_or_else(|e| e.into_inner());\n    let mut c = load();\n    let id = client_id.trim();\n    let secret = client_secret.trim();\n    if !id.is_empty() && id != c.client_id {\n        // Trocou de app: o token antigo não vale mais.\n        c.access_token.clear();\n        c.refresh_token.clear();\n        c.expires_at = 0;\n        c.username.clear();\n    }\n    if !id.is_empty() {\n        c.client_id = id.to_string();\n    }\n    if !secret.is_empty() {\n        c.client_secret = secret.to_string();\n    }\n    if c.client_id.is_empty() {\n        return Err(anyhow!(\"informe o client_id da sua app do Trakt\"));\n    }\n    store(&c)?;\n    Ok(c.view())\n}\n\npub fn disconnect() -> Result<CredsView> {\n    let _g = LOCK.lock().unwrap_or_else(|e| e.into_inner());\n    let mut c = load();\n    c.access_token.clear();\n    c.refresh_token.clear();\n    c.expires_at = 0;\n    c.username.clear();\n    store(&c)?;\n    Ok(c.view())\n}\n\n/// Apaga tudo, inclusive as credenciais da app.\npub fn forget() -> Result<CredsView> {","sourceCodeStart":110,"sourceCodeEnd":146,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/tools/lists/trakt.rs#L110-L146","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Create a Trakt application at https://trakt.tv/oauth/applications and copy its client_id","Pass the client_id string as the id argument to save_app (non-empty)","Check the input field is not blank — trim accidental whitespace-only input before calling","If a client_id was previously saved, confirm the credentials file loads (see 'sem pasta de dados' error if it does not)"],"exampleFix":"// before\ntrakt::save_app(\"\", \"some-secret\")?;\n// after\ntrakt::save_app(\"abc123def456clientid\", \"some-secret\")?;","handlingStrategy":"validation","validationCode":"let id = id.trim().to_string();\nif id.is_empty() {\n    return Err(\"preencha o client_id da app do Trakt antes de salvar\");\n}","typeGuard":null,"tryCatchPattern":"match trakt::save_app(&id, &secret) {\n    Err(e) if e.to_string().contains(\"client_id\") => {\n        eprintln!(\"crie uma app em trakt.tv/oauth/applications e cole o client_id\");\n    }\n    other => other?,\n}","preventionTips":["Create the Trakt application first and store the client_id in your settings UI","Trim and non-empty check the client_id input before calling save_app","Never clear the client_id field while leaving it required downstream"],"tags":["config","validation","trakt","oauth"],"backgroundTag":"missing-required-config-field","analyzedSha":"8600b91f4246848bac346874daa9e61c1fc5677a","analyzedAt":"2026-09-12T14:29:19.317Z","contentChangedAt":"2026-09-12T14:29:19.317Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}