tonhowtf/omniget · error · anyhow
conecte a conta do Trakt primeiro (o código aparece aqui e…
Error message
conecte a conta do Trakt primeiro (o código aparece aqui e você libera em trakt.tv/activate)
What it means
run() loads the stored Trakt credentials and, if access_token is empty, refuses to proceed because no OAuth session exists. The message tells the user to start the device-code flow: the code will appear in the app and must be activated at trakt.tv/activate.
Solutions
- Complete the Trakt device-code authentication in the app first (code appears in-app, activate at trakt.tv/activate)
- Verify the credentials file/store actually persisted the access token after auth
- Re-run the connect flow if the config was reset
- Check that the OAuth client_id is valid — a failed exchange can leave the token empty
Defensive patterns
Strategy: validation
Validate before calling
let c = trakt_config::load();
if c.access_token.is_empty() {
// start device-code auth flow before calling run
start_trakt_device_auth().await?;
} Type guard
fn is_connected(c: &Credentials) -> bool { !c.access_token.is_empty() } Try / catch
match trakt_lists::run(&opts, &progress).await {
Err(e) if e.to_string().contains("conecte a conta") => {
// trigger the in-app device-code connect flow (code + trakt.tv/activate)
}
other => other?,
} Prevention
- Run the device-code connect flow as onboarding before any export
- Verify access_token persisted to the config store after auth
- Detect expired/empty tokens at app startup and prompt reconnection
When it happens
Trigger: Calling run() before ever completing Trakt OAuth (credentials file has empty access_token), or after the stored config was reset/deleted.
Common situations: Fresh install with no account connected; config file corrupted or wiped; user connected a different tool that overwrote the credentials store; token never persisted after the device-code exchange.
Related errors
- a autorização do Trakt expirou de vez. Conecte a conta de…
- informe o client_id da sua app do Trakt
- informe primeiro o client_id da sua app do Trakt
- o device flow precisa do client_secret da sua app do Trakt
- o Trakt não devolveu o código do dispositivo
AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12).
Data as JSON: /api/errors/b16db27b7accad16.
Report an issue: GitHub.
Appendix: source
Thrown at src-tauri/omniget-core/src/core/tools/lists/trakt.rs:716
pub username: String,
pub entries: usize,
pub by_part: Vec<super::letterboxd::PartCount>,
pub requests: u32,
pub files: Vec<String>,
pub dest: String,
pub sample: Vec<Entry>,
}
pub async fn run(opts: &Options, p: ProgressFn) -> Result<ExportResult> {
if opts.dest.trim().is_empty() {
return Err(anyhow!("escolha a pasta de destino"));
}
let mut c = {
let _g = LOCK.lock().unwrap_or_else(|e| e.into_inner());
load()
};
if c.access_token.is_empty() {
return Err(anyhow!(
"conecte a conta do Trakt primeiro (o código aparece aqui e você libera em trakt.tv/activate)"
));
}
refresh_if_needed(&mut c).await?;
let api = Api::new(&c, opts.delay_ms)?;
let want =
|x: &str| opts.parts.is_empty() || opts.parts.iter().any(|s| s.eq_ignore_ascii_case(x));
// Quem é o usuário — serve de teste de token e nomeia o arquivo.
let mut username = c.username.clone();
if let Ok((v, _)) = api.get_page("/users/settings", 1, 1).await {
if let Some(u) = v
.get("user")
.and_then(|u| u.get("username"))
.and_then(|x| x.as_str())
{
username = u.to_string();
let _g = LOCK.lock().unwrap_or_else(|e| e.into_inner());View on GitHub (pinned to 8600b91f42)