[OnePlus 3 & 3T Cross Device Development] Deleted member 4405529:
The "Error 7" error

If a flashable zip is flashed in recovery, the rcobery extracts the zip and executes

META-INF/com/google/android/update-binary

If "update-binary" doesn't return successfully twrp based recoveries retrun a red line on the twrp console

Updater process ended with error: 7, Error installing zip file

This just means that "update-binary" hasn't completed successfully - nothing more, nothing less. It doesn't say anything on the reason, why it has failed.

There can be multiple reasons "update-binary" fails. Some of the more common (the list is neither complete, nor does it show any priorities)

Firmware too old

Device not matching

broken zip file

insufficient free blocks in the fs

wrong fs type on system, data and/or cache

typo in the updater script (extensivly tested by myself)

incompatible rom (i.e. zip is fpr system-as-root mount layout, but installed rom has no system-as-root mount layout - or vice versa)

[...]

As a logical consequence, there can't be a single or universal solution to "Error 7".

Fortunately twrp allows "update-binary" to write to te twrp console. This means the output (including error messages) of "update-binary" is written to the twrp console prior to the red "Error 7" line. Even more details on the reason why "update-binary" fails is the recobery log from twrp (Main Twrp page->Advanced->Copy log to SD).

This also means, that every answer, guide, yt-video etc. claimimg it can fix "Error 7", without asking for the last 2 to 4 lines before the red "Error 7" line may be right by accident, but not by knowledge.

The worst of all advices to fix "Error 7" is to edit "updater-script":

On all source build roms I know of "update-binary" is a edify interpreter reading "updater-script" as input(*). The updater script for nlos looks like this:

assert(getprop("ro.product.device") == "OnePlus3" || getprop("ro.build.product") == "OnePlus3" ||
getprop("ro.product.device") == "oneplus3" || getprop("ro.build.product") == "oneplus3" ||
getprop("ro.product.device") == "OnePlus3T" || getprop("ro.build.product") == "OnePlus3T" ||
getprop("ro.product.device") == "oneplus3t" || getprop("ro.build.product") == "oneplus3t" || abort("E3004: This package is for device: OnePlus3,oneplus3,OnePlus3T,oneplus3t; this device is " + getprop("ro.product.device") + "."););
assert(op3.verify_modem("2019-11-04 21:20:14") == "1" || abort("Error: This package requires firmware version OxygenOS 9.0.6 or newer. Please upgrade firmware and retry!"););
ui_print("Target: OnePlus/OnePlus3/OnePlus3:9/PKQ1.181203.001/1907311932:user/release-keys");
ifelse(is_mounted("/system"), unmount("/system"));
package_extract_dir("install", "/tmp/install");
set_metadata_recursive("/tmp/install", "uid", 0, "gid", 0, "dmode", 0755, "fmode", 0644);
set_metadata_recursive("/tmp/install/bin", "uid", 0, "gid", 0, "dmode", 0755, "fmode", 0755);
mount("ext4", "EMMC", "/dev/block/bootdevice/by-name/system", "/system", "");
run_program("/tmp/install/bin/backuptool.sh", "backup", "/system");
unmount("/system");
show_progress(0.750000, 0);
ui_print("Patching system image unconditionally...");
block_image_update("/dev/block/bootdevice/by-name/system", package_extract_file("system.transfer.list"), "system.new.dat.br", "system.patch.dat") ||
abort("E1001: Failed to update system image.");
show_progress(0.020000, 10);
mount("ext4", "EMMC", "/dev/block/bootdevice/by-name/system", "/system", "");
run_program("/tmp/install/bin/backuptool.sh", "restore", "/system");
unmount("/system");
show_progress(0.050000, 5);
package_extract_file("boot.img", "/dev/block/bootdevice/by-name/boot");
show_progress(0.200000, 10);
set_progress(1.000000);

If the cause for "Error 7" is a device mismatch (line 1 - 5), this may be caused because you don't flash it on an op3/t, or because the recovery you are using doesn't provide the properties "ro.product.device" or "ro.build.product". Though a flash would work when deleting these 5 lines from "updater script", the first case results in a bricked device, the second in a rom flash with an outdated or otherwise incompatible recovery.

If you flash nlos on top of a firmware not matching the blobs nlos uses, this will lead to unwanted side effects like not correctly working hardware parts like sensors including fingerprint scanner and camera. To avoid this "updater-script" has line 6. Deleting line 6 will allow you to flash nlos on an outdated firmware... :(

Obviously the better way is using a zip only for devices, recoveries and/or firmwares, they are made for.

Conclusion:

In order to solve "Error 7" it's mandatory to solve the "real" error. For this task it's inevitable to know the last lines before the red "Error 7" line on the twrp console and/or the revoery log (Main Twrp page->Advanced->Copy log to SD). The revovery log is always prefered, since it is more detailed then just the console output.

(*)in opposite to i.e. opengapps zips or magisk zips, where "uodate-binary" is a shell script. Both methods - edify interpreter or shell scripts - have their own advantages and drawbacks, generally spoken shell scripts are more flexible. Discussing the technical details is not part of this posting.