{"record":{"id":"8d2f192b17204937","repo":"apache/kafka","slug":"this-field-cannot-be-empty","errorCode":null,"errorMessage":"This field cannot be empty","messagePattern":"This field cannot be empty","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"warning","filePath":"docker/common.py","lineNumber":30,"sourceCode":"# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nimport subprocess\nimport tempfile\nimport os\nimport shutil\n\ndef execute(command):\n    if subprocess.run(command).returncode != 0:\n        raise SystemError(\"Failure in executing following command:- \", \" \".join(command))\n\ndef get_input(message):\n    value = input(message)\n    if value == \"\":\n        raise ValueError(\"This field cannot be empty\")\n    return value\n\ndef build_docker_image_runner(command, image_type, kafka_archive=None):\n    temp_dir_path = tempfile.mkdtemp()\n    current_dir = os.path.dirname(os.path.realpath(__file__))\n    shutil.copytree(f\"{current_dir}/{image_type}\", f\"{temp_dir_path}/{image_type}\", dirs_exist_ok=True)\n    shutil.copytree(f\"{current_dir}/resources\", f\"{temp_dir_path}/{image_type}/resources\", dirs_exist_ok=True)\n    shutil.copy(f\"{current_dir}/server.properties\", f\"{temp_dir_path}/{image_type}\")\n    if kafka_archive:\n        shutil.copy(kafka_archive, f\"{temp_dir_path}/{image_type}/kafka.tgz\")\n    command = command.replace(\"$DOCKER_FILE\", f\"{temp_dir_path}/{image_type}/Dockerfile\")\n    command = command.replace(\"$DOCKER_DIR\", f\"{temp_dir_path}/{image_type}\")\n    try:\n        execute(command.split())\n    except:\n        raise SystemError(\"Docker Image Build failed\")\n    finally:\n        shutil.rmtree(temp_dir_path)","sourceCodeStart":12,"sourceCodeEnd":48,"githubUrl":"https://github.com/apache/kafka/blob/996fb4585aa1bcc8980b0e1b8d6b168b986cd979/docker/common.py#L12-L48","documentation":"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).","triggerScenarios":"Running one of the docker release scripts interactively and pressing Enter at a prompt without typing a value.","commonSituations":"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.","solutions":["Provide a non-empty value at the prompt.","If running non-interactively, pipe values in: `echo \"value\" | python3 docker/...`.","Read the script to learn what each prompt expects (image tag, kafka archive URL, etc.) before running."],"exampleFix":"# before\n$ python3 docker/docker_release.py\nEnter kafka url: <Enter>  -> ValueError: This field cannot be empty\n\n# after\n$ python3 docker/docker_release.py\nEnter kafka url: https://archive.apache.org/dist/kafka/3.7.0/kafka_2.13-3.7.0.tgz","handlingStrategy":"validation","validationCode":"value = input(message).strip()\nif not value:\n    raise ValueError(\"This field cannot be empty\")\nreturn value","typeGuard":"null","tryCatchPattern":"while True:\n    try:\n        return get_input(message)\n    except ValueError:\n        print(\"please enter a value\")","preventionTips":["Have the expected values (image tag, kafka archive URL) ready before running the script.","Run interactively, not with empty stdin."],"tags":["docker","cli","release-tools","python","tooling"],"backgroundTag":null,"analyzedSha":"996fb4585aa1bcc8980b0e1b8d6b168b986cd979","analyzedAt":"2026-08-11T22:03:28.655Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}