apache/kafka · warning · ValueError

This field cannot be empty

Error message

This field cannot be empty

What it means

docker/common.py:get_input wraps the builtin input() prompt and rejects empty strings with ValueError('This field cannot be empty'). It is used by the interactive docker release scripts to require a non-empty answer (e.g. image tag, archive path).

Solutions

  1. Provide a non-empty value at the prompt.
  2. If running non-interactively, pipe values in: `echo "value" | python3 docker/...`.
  3. Read the script to learn what each prompt expects (image tag, kafka archive URL, etc.) before running.

Example fix

# before
$ python3 docker/docker_release.py
Enter kafka url: <Enter>  -> ValueError: This field cannot be empty

# after
$ python3 docker/docker_release.py
Enter kafka url: https://archive.apache.org/dist/kafka/3.7.0/kafka_2.13-3.7.0.tgz
Defensive patterns

Strategy: validation

Validate before calling

value = input(message).strip()
if not value:
    raise ValueError("This field cannot be empty")
return value

Type guard

null

Try / catch

while True:
    try:
        return get_input(message)
    except ValueError:
        print("please enter a value")

Prevention

When it happens

Trigger: Running one of the docker release scripts interactively and pressing Enter at a prompt without typing a value.

Common situations: Operator skips a prompt they did not understand; copy-paste into the terminal dropped the value; running the script non-interactively where stdin is empty.

Related errors


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

Appendix: source

Thrown at docker/common.py:30

# 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:
        execute(command.split())
    except:
        raise SystemError("Docker Image Build failed")
    finally:
        shutil.rmtree(temp_dir_path)

View on GitHub (pinned to 996fb4585a)