[General Questions and Answers] toto.1337:
Hello xda,

I have about the same issue with my Zenfone3 (ze520kl)

I tried to flash lineage-14.1-20170408-Z017 with TWRP but got an error 7. (it said that my phone is a ze520kl and not Z017)

After some research, i found that the "assert" lines can be deleted.

The problem is that now that the error 7 isn't here anymore, there goes the error 6.

Here is the original code:

(!less_than_int(1491664861, getprop("ro.build.date.utc"))) || abort("E3003: Can't install this package (Sat Apr 8 23:21:01 CST 2017) over newer build (" + getprop("ro.build.date") + ").");
assert(getprop("ro.product.device") == "ze520kl" || getprop("ro.build.product") == "Z017" || getprop("ro.product.device") == "ASUS_Z017D_1" || getprop("ro.build.product") == "ASUS_Z017D_1" || abort("E3004: This package is for device: Z017,ASUS_Z017D_1; this device is " + getprop("ro.product.device") + ";" +getprop("ro.build.product") "."););
ui_print("Target: asus/lineage_Z017/Z017:7.1.1/NOF27B/dfeb25c1ec:userdebug/test-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");
unmount("/system");
if is_mounted("/data") then
package_extract_file("META-INF/org/lineageos/releasekey", "/tmp/releasekey");
run_program("/tmp/install/bin/otasigcheck.sh") != "31744" || abort("Can't install this package on top of incompatible data. Please try another package or run a factory reset");
else
mount("ext4", "EMMC", "/dev/block/bootdevice/by-name/userdata", "/data", "");
package_extract_file("META-INF/org/lineageos/releasekey", "/tmp/releasekey");
run_program("/tmp/install/bin/otasigcheck.sh") != "31744" || abort("Can't install this package on top of incompatible data. Please try another package or run a factory reset");
unmount("/data");
endif;
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", "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");
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);

The lines I deleted were these ones:

(!less_than_int(1491664861, getprop("ro.build.date.utc"))) || abort("E3003: Can't install this package (Sat Apr 8 23:21:01 CST 2017) over newer build (" + getprop("ro.build.date") + ").");
assert(getprop("ro.product.device") == "ze520kl" || getprop("ro.build.product") == "Z017" || getprop("ro.product.device") == "ASUS_Z017D_1" || getprop("ro.build.product") == "ASUS_Z017D_1" || abort("E3004: This package is for device: Z017,ASUS_Z017D_1; this device is " + getprop("ro.product.device") + ";" +getprop("ro.build.product") "."););

Do you guys have an idea on how to flash it properly?

Or eventually get rid of the error 6?

Post-scriptum: After my first try, I got the phone in a bootloop and TWRP says that there is no OS.

I tried to flash with several ROMs but no one got passed the error 7 or 6 in TWRP.

The version of TWRP I have is 3.0.2-0