diff --git a/misc/build.func b/misc/build.func index 7f832630a..3b9a9921c 100644 --- a/misc/build.func +++ b/misc/build.func @@ -3262,6 +3262,9 @@ EOF' exit $install_exit_code fi + # Report failure to API before container cleanup + post_update_to_api "failed" "$install_exit_code" + # Prompt user for cleanup with 60s timeout (plain echo - no msg_info to avoid spinner) echo "" echo -en "${YW}Remove broken container ${CTID}? (Y/n) [auto-remove in 60s]: ${CL}" diff --git a/misc/error_handler.func b/misc/error_handler.func index d44250c62..e199958e9 100644 --- a/misc/error_handler.func +++ b/misc/error_handler.func @@ -213,6 +213,11 @@ error_handler() { # Offer to remove container if it exists (build errors after container creation) if [[ -n "${CTID:-}" ]] && command -v pct &>/dev/null && pct status "$CTID" &>/dev/null; then + # Report failure to API before container cleanup + if declare -f post_update_to_api &>/dev/null; then + post_update_to_api "failed" "$exit_code" + fi + echo "" echo -en "${YW}Remove broken container ${CTID}? (Y/n) [auto-remove in 60s]: ${CL}"