{"record":{"id":"17eb099e5ad1ff51","repo":"Hmbown/CodeWhale","slug":"android-loaded-image-is-not-an-executable-reg","errorCode":null,"errorMessage":"Android loaded image `{}` is not an executable regular file; refusing to select an update target","messagePattern":"Android loaded image `(.+?)` is not an executable regular file; refusing to select an update target","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/cli/src/update.rs","lineNumber":430,"sourceCode":"            \"failed to canonicalize Android loaded-image mapping {}\",\n            mapping.path.display()\n        )\n    })?;\n    if resolved_dladdr != resolved_mapping {\n        bail!(\n            \"Android loaded-image authorities disagree: dladdr resolved to {}, but /proc/self/maps resolved to {}\",\n            resolved_dladdr.display(),\n            resolved_mapping.display()\n        );\n    }\n    if is_android_linker_name(&resolved_mapping) {\n        bail!(\n            \"Android loaded-image authorities resolved to runtime linker {}; refusing to use the linker as an update target\",\n            resolved_mapping.display()\n        );\n    }\n    if !is_executable_file(&resolved_mapping) {\n        bail!(\n            \"Android loaded image `{}` is not an executable regular file; refusing to select an update target\",\n            resolved_mapping.display()\n        );\n    }\n\n    validate_android_mapping_identity(&mapping, &resolved_mapping)?;\n    Ok(AndroidExecutableProof {\n        path: resolved_mapping,\n        device_major: mapping.device_major,\n        device_minor: mapping.device_minor,\n        inode: mapping.inode,\n        proof_kind: AndroidExecutableProofKind::DladdrAndProcMaps,\n    })\n}\n\n#[cfg(any(target_os = \"android\", all(test, unix)))]\nfn validate_android_reported_path(authority: &str, path: &Path) -> Result<()> {\n    if !path.is_absolute() {","sourceCodeStart":412,"sourceCodeEnd":448,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/0c42157ee52f9d55af2b506d71b46249910f77d3/crates/cli/src/update.rs#L412-L448","documentation":"After both Android authorities agreed on a canonical path, is_executable_file found it is not an executable regular file (missing any execute bit or not a regular file). The updater refuses to select such a target because writing an update there could clobber something that is not the running program.","triggerScenarios":"Android self-update where the resolved image path lost its execute bit or is no longer a regular file - e.g. the binary was copied via unzip/MTP without preserving modes, chmod -x was applied, or the path now points at a symlink target/special file.","commonSituations":"Binaries extracted from archives without permission preservation, sideloaded copies, permission resets by sync tools.","solutions":["Restore the execute bit: chmod +x <path-from-message>","Reinstall the binary using the documented installer so modes are set correctly","Confirm the path is a regular file (ls -l) and not a directory or special file"],"exampleFix":"// before\n$ ls -l /data/local/tmp/codewhale\n-rw-r--r-- 1 user user 12345 codewhale\ncodewhale update  # -> Android loaded image ... is not an executable regular file\n\n// after\n$ chmod +x /data/local/tmp/codewhale\ncodewhale update  # proceeds","handlingStrategy":"validation","validationCode":"use std::os::unix::fs::PermissionsExt;\n\nfn image_is_executable_regular_file(path: &std::path::Path) -> bool {\n    std::fs::metadata(path)\n        .map(|m| m.is_file() && m.permissions().mode() & 0o111 != 0)\n        .unwrap_or(false)\n}\n\n// run before self-update:\nif !image_is_executable_regular_file(&std::env::current_exe().unwrap()) {\n    eprintln!(\"binary lost its execute bit; fix with chmod +x before updating\");\n}","typeGuard":null,"tryCatchPattern":"Catch the error and, because the resolved path is included in the message, offer to run chmod +x on that exact path, then retry the update once.","preventionTips":["Extract release archives with permission preservation (unzip keeps modes; some GUI tools do not)","After copying the binary, always chmod +x","Verify with ls -l that the image is a regular executable file before updating"],"tags":["android","file-permissions","self-update"],"backgroundTag":"binary-not-executable","analyzedSha":"0c42157ee52f9d55af2b506d71b46249910f77d3","analyzedAt":"2026-08-20T21:50:45.477Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}