stanfordnlp/CoreNLP · warning

Could not parse subnet

Error message

Could not parse subnet: ${subnet}

What it means

When loading a block list of subnets, StanfordCoreNLPServer parses each line into a subnet via parseSubnet. If a line is not a valid subnet (bad CIDR notation, garbage line, comment typo), the IllegalArgumentException is caught and this warning is logged; the bad subnet is skipped rather than failing server startup.

Solutions

  1. Open the block-list file and fix or remove the invalid subnet line logged in the warning
  2. Use proper CIDR notation, e.g. 10.0.0.0/8 or 192.168.1.0/24
  3. Remove comment lines and blank lines from the block list
  4. Validate each line with a CIDR checker before deploying the file

Example fix

// before (blocklist.txt)
10.0.0.0/33
bad-subnet
// after (blocklist.txt)
10.0.0.0/8
192.168.1.0/24
Defensive patterns

Strategy: validation

Validate before calling

Pattern CIDR = Pattern.compile("^(\\d{1,3}\\.){3}\\d{1,3}/\\d{1,2}$");
for (String line : Files.readAllLines(blockList)) {
  if (!CIDR.matcher(line.trim()).matches())
    throw new IllegalArgumentException("Invalid subnet in block list: " + line);
}

Prevention

When it happens

Trigger: Starting the server with a block-list file (-blockList or blockListSubnets property) containing a line that is not valid CIDR, e.g. '10.0.0.0/33', 'abc', or an empty/malformed line.

Common situations: Hand-edited block list files with typos; lists generated by other tools with comments or headers left inline; IPv6 entries when the parser expects IPv4 (or vice versa).

Understand the failure class

Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.

Related errors


AI-assisted analysis of stanfordnlp/CoreNLP@1b7edd19c4 (2026-09-10). Data as JSON: /api/errors/fd4bb89213e5b386. Report an issue: GitHub.

Appendix: source

Thrown at src/edu/stanford/nlp/pipeline/StanfordCoreNLPServer.java:245

    }
    this.shutdownKey = new BigInteger(130, new Random()).toString(32);
    IOUtils.writeStringToFile(shutdownKey, tmpFile.getPath(), "utf-8");
    // set status port
    if (props != null && props.containsKey("status_port")) {
      this.statusPort = Integer.parseInt(props.getProperty("status_port"));
    } else if (props != null && props.containsKey("port")) {
      this.statusPort = Integer.parseInt(props.getProperty("port"));
    }
    // parse blockList
    if (blockList == null) {
      this.blockListSubnets = Collections.emptyList();
    } else {
      this.blockListSubnets = new ArrayList<>();
      for (String subnet : IOUtils.readLines(blockList)) {
        try {
          this.blockListSubnets.add(parseSubnet(subnet));
        } catch (IllegalArgumentException e) {
          warn("Could not parse subnet: " + subnet);
        }
      }
    }
  }

  /**
   * Parse the URL parameters into a map of (key, value) pairs. <br>
   * https://codereview.stackexchange.com/questions/175332/splitting-url-query-string-to-key-value-pairs
   *
   * @param uri The URL that was requested.
   *
   * @return A map of (key, value) pairs corresponding to the request parameters.
   *
   * @throws IllegalStateException Thrown if we could not decode the URL with utf8.
   */
  private static Map<String, String> getURLParams(URI uri) {
    String query = uri.getRawQuery();
    if (query != null) {

View on GitHub (pinned to 1b7edd19c4)