{"record":{"id":"6125c237f1f3c047","repo":"Universal-Debloater-Alliance/universal-android-debloater-next-generation","slug":"string-assumed-to-be-uid-numeral","errorCode":null,"errorMessage":"string assumed to be UID numeral","messagePattern":"string assumed to be UID numeral","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/uad-core/src/adb.rs","lineNumber":420,"sourceCode":"                    //run = true;\n                    l.trim_ascii_end()\n                } else {\n                    //run = false;\n                    ln\n                };\n                let ln = ln.strip_suffix('}').unwrap_or(ln).trim_ascii_end();\n                // https://android.googlesource.com/platform/frameworks/base/+/refs/heads/main/core/java/android/content/pm/UserInfo.java\n                // The format looks stable today, but google may change it in future Android versions\n                // (and very old Androids might differ). Keep parsing defensive.\n                // Expected shape: \"UserInfo{<id>:<name>:<flags>}[ running]\"\n\n                let mut comps = ln.split(':');\n\n                let id = comps\n                    .next()\n                    .expect(\"There must be at least 1 ':'-separated component\")\n                    .parse()\n                    .expect(\"string assumed to be UID numeral\");\n                //let name = comps\n                //    .next()\n                //    .expect(\"There must be at least 2 ':'-separated components. 2nd is user-name\");\n                //let flags = u32::from_str_radix(\n                //    comps.next().expect(\n                //        \"There must be at least 3 ':'-separated components. 3rd is user bit-flags\",\n                //    ),\n                //    16,\n                //)\n                //.expect(\"string assumed to be hexadecimal bit-flags\");\n                UserInfo {\n                    id,\n                    //name: name.into(),\n                    //flags,\n                    //running: run,\n                }\n            })\n            .collect())","sourceCodeStart":402,"sourceCodeEnd":438,"githubUrl":"https://github.com/Universal-Debloater-Alliance/universal-android-debloater-next-generation/blob/64465c850c7ed36329e67165ac08501abffb218e/crates/uad-core/src/adb.rs#L402-L438","documentation":"In list_users, the first ':'-separated component of a UserInfo line is parsed as the numeric user ID; if parse() fails, expect panics with \"string assumed to be UID numeral\". The library assumes adb always reports a decimal UID in the first field.","triggerScenarios":"Calling list_users() when the id field of a UserInfo line is not a valid integer — malformed or truncated adb output, or a ROM emitting a different UserInfo format where the first segment is non-numeric.","commonSituations":"Truncated output over a flaky USB/wireless adb connection, modified pm binary, localized or OEM-altered user listings.","solutions":["Re-run `adb shell pm list users` to rule out truncated/corrupt output.","Inspect the offending line and confirm it matches UserInfo{<int>:...}.","Replace the device or update its ROM/Android version if the format is non-standard.","Patch parsing to fall back gracefully (e.g. .ok() and skip the line) instead of expect."],"exampleFix":"// before\n.parse().expect(\"string assumed to be UID numeral\")\n// after\nlet id: u32 = comps.next()?.trim().parse().ok()?; // skip line on parse failure","handlingStrategy":"validation","validationCode":"let first = line.trim_start().trim_start_matches(\"UserInfo{\");\nlet id_str = first.split(':').next().unwrap_or(\"\");\nif id_str.parse::<u32>().is_err() { return Err(format!(\"non-numeric user id: {id_str:?}\")); }","typeGuard":"fn parse_user_id(seg: &str) -> Option<u32> { seg.trim().parse::<u32>().ok() }","tryCatchPattern":"let users = std::panic::catch_unwind(|| adb::list_users()).unwrap_or_else(|_| { eprintln!(\"user id parse failed; check device output\"); Vec::new() });","preventionTips":["Pre-validate the id segment parses as u32 before calling list_users-derived flows.","Handle truncated adb output (flaky USB/wireless) by re-running the command on failure.","Test against the exact ROMs/Android versions you support.","Use .parse().ok() with line-skipping instead of expect."],"tags":["adb","parsing","panic","integer-parse"],"backgroundTag":"invalid-argument-format","analyzedSha":"64465c850c7ed36329e67165ac08501abffb218e","analyzedAt":"2026-09-12T09:09:23.137Z","contentChangedAt":"2026-09-12T09:09:23.137Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}