projectlombok/lombok · error · IOException

Expected a span with id 'currentVersion'

Error message

Expected a span with id 'currentVersion'

What it means

FetchCurrentVersion.fetchVersionFromSite downloads a project web page and scans each line against VERSION_PATTERN looking for a span whose id is 'currentVersion' (or 'currentVersionFull' when fetchFull). If no line matches (or the id doesn't correspond to the requested variant), it throws this IOException. It means the fetched page did not contain the expected version marker.

Solutions

  1. Inspect the HTML actually fetched (curl the URL) and confirm whether a span with id 'currentVersion' (or 'currentVersionFull') exists.
  2. Check you are hitting the live site, not an error/redirect/consent page — resolve redirects or update the URL in the script.
  3. If the site markup changed, update VERSION_PATTERN or the span id in FetchCurrentVersion to match the new HTML.
  4. Match the fetchFull flag to the marker actually present: fetchFull=true requires 'currentVersionFull'.

Example fix

// before (page changed id)
<span id="latestVersion">1.18.30</span>  -> IOException("Expected a span with id 'currentVersion'")
// after (update pattern/expected id in code)
Matcher m = Pattern.compile(".*id=.(currentVersionFull|latestVersion).*?>(((\\d+)\\.(\\d+))).*").matcher(line);
Defensive patterns

Strategy: try-catch

Try / catch

try {
    String v = fetchVersionFromSite(url, fetchFull);
} catch (IOException e) {
    if ("Expected a span with id 'currentVersion'".equals(e.getMessage())) {
        // dump fetched HTML, check for redirect/error page or changed span id
        String html = slurp(url);
        if (!html.contains("currentVersion")) throw new IllegalStateException("Page no longer contains version marker; update VERSION_PATTERN", e);
    } else throw e;
}

Prevention

When it happens

Trigger: main -> fetchVersionFromSite against the project website when the HTML changed (span id renamed/removed), a CDN/error/consent page is returned instead of the real site, the wrong variant is requested (fetchFull=true but page only shows 'currentVersion'), or the URL points to a page that never carries the marker.

Common situations: Website redesign changes the span id; project.eclipse.org serves a maintenance/error page; mirroring a page that only contains currentVersionFull (or vice versa); network middleboxes (captive portal) inject HTML.

Understand the failure class

Background: "invalid response format", "malformed payload", "missing data field": when an API returns 200 but the response shape is wrong — this error's family across 23 libraries.

Related errors


AI-assisted analysis of projectlombok/lombok@6d6a3e9fec (2026-09-07). Data as JSON: /api/errors/e4d88b3cd66e0916. Report an issue: GitHub.

Appendix: source

Thrown at src/support/lombok/website/FetchCurrentVersion.java:28

public class FetchCurrentVersion {
	private FetchCurrentVersion() {}
	
	private static final Pattern VERSION_PATTERN = Pattern.compile("^.*<\\s*span\\s+id\\s*=\\s*[\"'](currentVersion|currentVersionFull)[\"'](?:\\s+style\\s*=\\s*[\"']display\\s*:\\s*none;?[\"'])?\\s*>\\s*([^\t<]+)\\s*<\\s*/\\s*span\\s*>.*$");
	
	public static void main(String[] args) throws IOException {
		System.out.print(fetchVersionFromSite(args.length < 2 || args[1].equals("full"), new Domain(args.length < 1 ? "" : args[0])));
	}
	
	public static String fetchVersionFromSite(boolean fetchFull, Domain domain) throws IOException {
		InputStream in = domain.url("download").openStream();
		try {
			BufferedReader br = new BufferedReader(new InputStreamReader(in, "UTF-8"));
			try {
				for (String line = br.readLine(); line != null; line = br.readLine()) {
					Matcher m = VERSION_PATTERN.matcher(line);
					if (m.matches() && m.group(1).equals("currentVersionFull") == fetchFull) return m.group(2).replace("&quot;", "\"");
				}
				throw new IOException("Expected a span with id 'currentVersion'");
			} finally {
				br.close();
			}
		} finally {
			in.close();
		}
	}
}

View on GitHub (pinned to 6d6a3e9fec)