quarkusio/quarkus · critical · RuntimeException

Unable to generate stable port number from input string: '

Error message

Unable to generate stable port number from input string: '

What it means

When hashing the input string to derive a stable port, any unexpected failure (e.g. the MessageDigest algorithm is unavailable) is wrapped in a RuntimeException with the offending input in the message. The DEFAULT_HASH_ALGORITHM is 'MD5', so this should almost never happen on a standard JVM.

Source

Thrown at extensions/kubernetes/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/BaseVanillaKubernetesProcessor.java:176

    }

    /**
     * Given a string, generate a port number within the supplied range
     * The output is always the same (between {@code min} and {@code max})
     * given the same input and it's useful when we need to generate a port number
     * which needs to stay the same but we don't care about the exact value
     */
    private static int getStablePortNumberInRange(String input, int min, int max) {
        if (min < MIN_PORT_NUMBER || max > MAX_PORT_NUMBER) {
            throw new IllegalArgumentException(
                    String.format("Port number range must be within [%d-%d]", MIN_PORT_NUMBER, MAX_PORT_NUMBER));
        }

        try {
            byte[] hash = MessageDigest.getInstance(DEFAULT_HASH_ALGORITHM).digest(input.getBytes(StandardCharsets.UTF_8));
            return min + new BigInteger(hash).mod(BigInteger.valueOf(max - min)).intValue();
        } catch (Exception e) {
            throw new RuntimeException("Unable to generate stable port number from input string: '" + input + "'", e);
        }
    }
}

View on GitHub (pinned to e1c734241f)

Solutions

  1. Check that the JVM security providers allow the hash algorithm (MD5); on FIPS JVMs enable it or change DEFAULT_HASH_ALGORITHM to SHA-256
  2. Rebuild on a standard JVM distribution and retry the build
  3. Inspect the wrapped cause ('Caused by') in the stack trace to identify the missing algorithm

Example fix

// before (codebase)
MessageDigest.getInstance(DEFAULT_HASH_ALGORITHM);
// after (if FIPS JVM blocks MD5)
MessageDigest.getInstance("SHA-256");
Defensive patterns

Strategy: try-catch

Validate before calling

try { java.security.MessageDigest.getInstance("MD5"); } catch (Exception e) { /* algorithm unavailable — switch algorithm */ }

Try / catch

try { int port = generateStablePort(name, 1025, 65535); } catch (RuntimeException e) { LOG.errorf(e, "stable port generation failed for %s", name); throw e; }

Prevention

When it happens

Trigger: getStablePortNumberInRange calls MessageDigest.getInstance(DEFAULT_HASH_ALGORITHM) and the JVM does not provide that algorithm, or any other exception occurs while hashing.

Common situations: Running on a restricted/custom JRE or FIPS-hardened JVM where MD5 is disabled; extremely unusual, since MD5 is part of standard JVM providers.

Related errors


AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05). Data as JSON: /api/errors/0f4ece4ab9b67ca6. Report an issue: GitHub.