apache/kafka · error · SystemError

Failure in executing following command:-

Error message

Failure in executing following command:- 

What it means

docker/common.py:execute runs a command via subprocess.run and, if the return code is non-zero, raises SystemError with the joined command string. (Note: SystemError is a Python builtin reserved for interpreter-level errors - using it here is questionable, but it is the shipped behavior.) The actual stderr/stdout of the failing command is NOT captured into the exception; only the command line is included.

Solutions

  1. Re-run the exact failing command manually to see its stderr (execute hides it).
  2. Ensure docker and docker buildx are installed and the daemon is reachable (`docker info`).
  3. If the failure is 'builder already exists', remove it first (`docker buildx rm kafka-builder`).
  4. Patch execute locally to capture stderr (subprocess.run(..., check=True, capture_output=True)) so the error surface is visible.

Example fix

# before (library code swallows stderr)
execute(["docker", "buildx", "create", "--name", "kafka-builder", "--use"])
# raises SystemError('Failure in executing following command:- ', 'docker buildx create ...')

# debug locally
$ docker buildx create --name kafka-builder --use
# stderr shows the real cause, e.g. 'existing instance ...'
Defensive patterns

Strategy: try-catch

Validate before calling

import shutil
if shutil.which(command[0]) is None:
    raise SystemExit(f"'{command[0]}' not found on PATH")

Type guard

null

Try / catch

from common import execute
try:
    execute(cmd)
except SystemError as e:
    print(f"Command failed: {' '.join(cmd)}\nRe-run manually for stderr.", file=sys.stderr)
    raise

Prevention

When it happens

Trigger: Calling execute([...]) where the subprocess exits non-zero - e.g. `docker buildx create`, `docker buildx rm`, `git`, or any CLI invoked by the docker/release scripts that fails.

Common situations: Docker not installed or not on PATH; permission denied talking to the docker daemon; buildx plugin missing; a previous run left state that makes the command fail (e.g. builder already exists).

Related errors


AI-assisted analysis of apache/kafka@996fb4585a (2026-08-11). Data as JSON: /api/errors/a84a8bf7d624887a. Report an issue: GitHub.

Appendix: source

Thrown at docker/common.py:25

# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import subprocess
import tempfile
import os
import shutil

def execute(command):
    if subprocess.run(command).returncode != 0:
        raise SystemError("Failure in executing following command:- ", " ".join(command))

def get_input(message):
    value = input(message)
    if value == "":
        raise ValueError("This field cannot be empty")
    return value

def build_docker_image_runner(command, image_type, kafka_archive=None):
    temp_dir_path = tempfile.mkdtemp()
    current_dir = os.path.dirname(os.path.realpath(__file__))
    shutil.copytree(f"{current_dir}/{image_type}", f"{temp_dir_path}/{image_type}", dirs_exist_ok=True)
    shutil.copytree(f"{current_dir}/resources", f"{temp_dir_path}/{image_type}/resources", dirs_exist_ok=True)
    shutil.copy(f"{current_dir}/server.properties", f"{temp_dir_path}/{image_type}")
    if kafka_archive:
        shutil.copy(kafka_archive, f"{temp_dir_path}/{image_type}/kafka.tgz")
    command = command.replace("$DOCKER_FILE", f"{temp_dir_path}/{image_type}/Dockerfile")
    command = command.replace("$DOCKER_DIR", f"{temp_dir_path}/{image_type}")
    try:

View on GitHub (pinned to 996fb4585a)