elastic/elasticsearch · error · RuntimeException

Could not find base id: {}

Error message

Could not find base id: {}

What it means

RuntimeException from resetUpperBounds() in AbstractGenerateTransportVersionDefinitionTask when the idsByBase map has no entry for upperBound.definitionId().base(). This indicates an internal invariant violation: an upper bound references a base id that no definition populated.

Source

Thrown at build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/transport/AbstractGenerateTransportVersionDefinitionTask.java:153

            } else if (resources.getChangedUpperBoundNames().contains(upperBoundName)) {
                // Default case: we're not targeting this branch so reset it
                resetUpperBound(resources, existingUpperBound, idsByBase, definitionName);
            }
        }

        Collections.sort(ids);
        return ids;
    }

    private void resetUpperBound(
        TransportVersionResourcesService resources,
        TransportVersionUpperBound upperBound,
        Map<Integer, List<IdAndDefinition>> idsByBase,
        String ignoreDefinitionName
    ) throws IOException {
        List<IdAndDefinition> idsForUpperBound = idsByBase.get(upperBound.definitionId().base());
        if (idsForUpperBound == null) {
            throw new RuntimeException("Could not find base id: " + upperBound.definitionId().base());
        }
        IdAndDefinition resetValue = idsForUpperBound.getLast();
        if (resetValue.definition().name().equals(ignoreDefinitionName)) {
            // there must be another definition in this base since the ignored definition is new
            assert idsForUpperBound.size() >= 2;
            resetValue = idsForUpperBound.get(idsForUpperBound.size() - 2);
        }
        var resetUpperBound = new TransportVersionUpperBound(upperBound.name(), resetValue.definition().name(), resetValue.id());
        resources.writeUpperBound(resetUpperBound);
    }

    private TransportVersionId maybeGetExistingId(
        TransportVersionUpperBound upperBound,
        TransportVersionDefinition existingDefinition,
        String name
    ) {
        if (existingDefinition == null) {
            // the name doesn't yet exist, so there is no id to return

View on GitHub (pinned to db6a809a66)

Solutions

  1. Inspect the upper-bound file referenced and its definitionId().base() value.
  2. Cross-check that base against the definition files that populate idsByBase (look for a definition with that base).
  3. Restore the missing definition from git, or remove the orphaned upper-bound entry.
  4. Re-run on a clean checkout of the transport-version resources directory.
Defensive patterns

Strategy: validation

Validate before calling

List<IdAndDefinition> idsForUpperBound = idsByBase.get(upperBound.definitionId().base());
if (idsForUpperBound == null) {
    throw new IllegalStateException("Upper bound '" + upperBound.name() + "' references unknown base " + upperBound.definitionId().base() + "; available bases: " + idsByBase.keySet());
}

Prevention

When it happens

Trigger: The transport-version resource files are inconsistent - an upper-bound CSV references a base number that does not appear as a key in idsByBase, which is built from existing definitions.

Common situations: Manually edited transport-version resource files; a partial merge/rebase leaving an upper bound pointing at a deleted definition; corruption from a concurrent run writing to the resources dir.

Related errors


AI-assisted analysis of elastic/elasticsearch@db6a809a66 (2026-08-12). Data as JSON: /api/errors/d59634434db54702. Report an issue: GitHub.