{"record":{"id":"33dbe60ac90ab3a1","repo":"testcontainers/testcontainers-java","slug":"pathinhomefolder-must-not-be-empty","errorCode":null,"errorMessage":"pathInHomeFolder must not be empty","messagePattern":"pathInHomeFolder must not be empty","errorType":"exception","errorClass":"ContainerLaunchException","httpStatus":null,"severity":"error","filePath":"modules/hivemq/src/main/java/org/testcontainers/hivemq/HiveMQContainer.java","lineNumber":409,"sourceCode":"    }\n\n    /**\n     * Puts the given file into the given subdirectory of the HiveMQ home folder '/opt/hivemq/{pathInHomeFolder}'.\n     * <p>\n     * Must be called before the container is started.\n     *\n     * @param mountableFile    the file on the host machine\n     * @param pathInHomeFolder the path\n     * @return self\n     */\n    public @NotNull HiveMQContainer withFileInHomeFolder(\n        final @NotNull MountableFile mountableFile,\n        final @NotNull String pathInHomeFolder\n    ) {\n        final File file = new File(mountableFile.getResolvedPath());\n\n        if (pathInHomeFolder.trim().isEmpty()) {\n            throw new ContainerLaunchException(\"pathInHomeFolder must not be empty\");\n        }\n\n        if (!file.exists()) {\n            throw new ContainerLaunchException(\"File '\" + mountableFile.getFilesystemPath() + \"' does not exist.\");\n        }\n        final String containerPath = \"/opt/hivemq\" + PathUtil.prepareAppendPath(pathInHomeFolder);\n        withCopyFileToContainer(cloneWithFileMode(mountableFile), containerPath);\n        LOGGER.info(\"Putting file '{}' into container path '{}'.\", file.getAbsolutePath(), containerPath);\n        return self();\n    }\n\n    /**\n     * Disables the extension with the given name and extension directory name.\n     * This method blocks until the HiveMQ log for successful disabling is consumed or it times out after {timeOut}.\n     * Note: Disabling Extensions is a HiveMQ Enterprise feature, it will not work when using the HiveMQ Community Edition.\n     * <p>\n     * This can only be called once the container is started.\n     *","sourceCodeStart":391,"sourceCodeEnd":427,"githubUrl":"https://github.com/testcontainers/testcontainers-java/blob/8e549514e3f01c57d70546fbb8599d138f3903e5/modules/hivemq/src/main/java/org/testcontainers/hivemq/HiveMQContainer.java#L391-L427","documentation":"withFileInHomeFolder(MountableFile, String pathInHomeFolder) requires a non-blank relative path inside /opt/hivemq. If pathInHomeFolder is null-blank (only whitespace), a ContainerLaunchException is thrown, because the library cannot compute the container destination path.","triggerScenarios":"Calling container.withFileInHomeFolder(mountableFile, \"   \") or withFileInHomeFolder(mountableFile, \"\") — or indirectly via withFileInExtensionHomeFolder with an empty path argument.","commonSituations":"Path value loaded from an empty config property or environment variable; variable interpolation failing and yielding empty string; caller confusing withFileInHomeFolder with a variant that takes no path.","solutions":["Pass a non-empty relative path such as \"/extension/my-extension/extra.properties\".","Validate/default the path variable before the call (e.g. Optional.ofNullable(path).filter(p->!p.isBlank()).orElse(defaultPath)).","If you meant to place a file in an extension folder, use withFileInExtensionHomeFolder(extensionId, file, path)."],"exampleFix":"// before\ncontainer.withFileInHomeFolder(file, \"\");\n// after\ncontainer.withFileInHomeFolder(file, \"/extension/my-extension/config.properties\");","handlingStrategy":"validation","validationCode":"if (pathInHomeFolder == null || pathInHomeFolder.isBlank()) throw new IllegalArgumentException(\"pathInHomeFolder required\");","typeGuard":null,"tryCatchPattern":"try { container.withFileInHomeFolder(file, path); } catch (ContainerLaunchException e) { log.error(\"Bad home path: {}\", e.getMessage()); throw e; }","preventionTips":["Never pass path values straight from optional env/config without a default.","Centralize container path constants instead of interpolating empty strings."],"tags":["hivemq","empty-argument","validation","testcontainers"],"backgroundTag":"empty-required-field","analyzedSha":"8e549514e3f01c57d70546fbb8599d138f3903e5","analyzedAt":"2026-09-12T14:56:41.227Z","contentChangedAt":"2026-09-12T14:56:41.227Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}