apache/kafka · warning · ValueError
This field cannot be empty
Error message
This field cannot be empty
What it means
Raised by docker/common.get_input() when the user presses Enter without typing anything at the input() prompt. get_input() is the interactive prompt wrapper used by the docker release/build helper scripts to collect required values (image name, kafka url, image type, etc.). An empty answer is treated as an invalid required field rather than silently proceeding.
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 c31c9215e1)
Solutions
- Provide a non-empty value at the prompt.
- If running non-interactively, feed values via stdin or switch to argparse/CLI flags (as docker_release.py already does) instead of prompts.
- If the value should be optional, modify the caller to pass a default instead of relying on get_input.
Example fix
# before
image = get_input("Docker image: ") # user hits Enter
# after
image = get_input("Docker image: ") # user types apache/kafka:latest
# or run with CLI flags: ./docker_release.py apache/kafka:latest --image-type jvm Defensive patterns
Strategy: validation
Validate before calling
# Strip whitespace and reject empty input before it reaches get_input().
value = input(message).strip()
if not value:
raise ValueError("This field cannot be empty") Type guard
# Treat None and blank strings as invalid for required interactive fields.
def is_non_empty_str(v) -> bool:
return isinstance(v, str) and v.strip() != "" Try / catch
from common import get_input
try:
value = get_input(message)
except ValueError:
# Re-prompt the user instead of crashing the release flow.
value = get_input(message + " (required): ") Prevention
- Use argparse with required=True for CLI args instead of interactive prompts wherever possible.
- Pre-validate interactive input with .strip() so whitespace-only answers are rejected.
- Provide a --non-interactive mode that reads from env vars or a config file for CI.
When it happens
Trigger: Calling get_input(message) and responding with an empty string (just Enter) at the interactive prompt.
Common situations: User skipped a required prompt by accident, hit Enter to accept a default that doesn't exist, ran the script non-interactively (piped empty stdin) so all prompts read empty, or terminal sent an unexpected newline.
Related errors
- Failure in executing following command:-
- Docker Image Build failed
- Docker image push failed
- Unexpected contents in the artifact. Exactly one version dir
- Cannot specify a negative version level.
AI-assisted analysis of apache/kafka@c31c9215e1 (2026-08-03).
Data as JSON: /data/errors/8d2f192b17204937.json.
Report an issue: GitHub.