{"record":{"id":"b633b74a78a88fd3","repo":"tonhowtf/omniget","slug":"indices-de-assinatura-nao-encontrados","errorCode":null,"errorMessage":"indices de assinatura nao encontrados","messagePattern":"indices de assinatura nao encontrados","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/core/tools/x/txid.rs","lineNumber":328,"sourceCode":"                indices_re().find(&text).map(|m| join_url(&s, m.as_str()))\n            }));\n        }\n        for t in tasks {\n            if let Ok(Some(u)) = t.await {\n                url = Some(u);\n                break;\n            }\n        }\n    }\n    let url = url.ok_or_else(|| anyhow::anyhow!(\"chunk de assinatura do X nao encontrado\"))?;\n    let text = page_text(http, &url, cookie).await?;\n    let re_idx = regex::Regex::new(r\"\\(\\w\\[(\\d{1,2})\\],\\s*16\\)\").unwrap();\n    let items: Vec<usize> = re_idx\n        .captures_iter(&text)\n        .filter_map(|c| c[1].parse().ok())\n        .collect();\n    if items.is_empty() {\n        anyhow::bail!(\"indices de assinatura nao encontrados\");\n    }\n    Ok(items)\n}\n\nimpl TxIdGen {\n    /// Precisa da sessao logada: o X so entrega a pagina com os indices para\n    /// quem esta autenticado.\n    pub async fn create(http: &reqwest::Client, cookie: Option<&str>) -> anyhow::Result<Self> {\n        let html = page_text(http, \"https://x.com/tesla\", cookie).await?;\n        let vk = verification_bytes(&html)?;\n        let rows = anim_frames(&html, &vk)?;\n        let idx = indices(http, &html, cookie).await?;\n        let mut frame_time: i64 = 1;\n        for i in idx.iter().skip(1) {\n            frame_time *= (vk.get(*i).copied().unwrap_or(0) % 16) as i64;\n        }\n        let frame_time = ((frame_time as f64 / 10.0 + 0.5).floor() * 10.0) as i64;\n        let frame_idx = (vk.get(idx[0]).copied().unwrap_or(0) % 16) as usize;","sourceCodeStart":310,"sourceCodeEnd":346,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/tools/x/txid.rs#L310-L346","documentation":"indices() scans a script bundle for the regex (\\w\\[(\\d{1,2})\\],\\s*16) that yields signature-index numbers used by TxIdGen; it bails when no matches are found. Without these indices the txid signature algorithm cannot be constructed.","triggerScenarios":"Calling create() when the downloaded x-web script content contains no matches for the index regex — the bundle changed structure, the wrong script was fetched, or the regex constant set (16) changed.","commonSituations":"X shipped a new bundle where the array literal pattern differs (different constant, multi-digit index, different call shape); content was fetched but decompression/decoding failed; regex too narrow.","solutions":["Log the fetched script text and update the regex to the new pattern shape.","Broaden the regex (e.g., allow more index digits or different whitespace/constant).","Ensure the script content is fully decoded (UTF-8, decompressed) before scanning.","Retry the fetch — a truncated or partial download can also yield no matches."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"match TxIdGen::create(...).await {\n    Err(e) if e.to_string().contains(\"indices de assinatura\") => {\n        // refetch bundles once; if it persists, flag regex drift for maintenance\n        retry_once().await?\n    }\n    other => other?,\n}","preventionTips":["Add a periodic canary test that builds a TxIdGen so regex drift is caught early.","Keep the index regex configurable so it can be updated without a code deploy.","Ensure downloaded scripts are fully decoded before scanning."],"tags":["regex","scraping","parsing"],"backgroundTag":"unexpected-response-shape","analyzedSha":"8600b91f4246848bac346874daa9e61c1fc5677a","analyzedAt":"2026-09-12T14:29:19.317Z","contentChangedAt":"2026-09-12T14:29:19.317Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}