{"record":{"id":"d59634434db54702","repo":"elastic/elasticsearch","slug":"could-not-find-base-id","errorCode":null,"errorMessage":"Could not find base id: {}","messagePattern":"Could not find base id: (.+?)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/transport/AbstractGenerateTransportVersionDefinitionTask.java","lineNumber":153,"sourceCode":"            } else if (resources.getChangedUpperBoundNames().contains(upperBoundName)) {\n                // Default case: we're not targeting this branch so reset it\n                resetUpperBound(resources, existingUpperBound, idsByBase, definitionName);\n            }\n        }\n\n        Collections.sort(ids);\n        return ids;\n    }\n\n    private void resetUpperBound(\n        TransportVersionResourcesService resources,\n        TransportVersionUpperBound upperBound,\n        Map<Integer, List<IdAndDefinition>> idsByBase,\n        String ignoreDefinitionName\n    ) throws IOException {\n        List<IdAndDefinition> idsForUpperBound = idsByBase.get(upperBound.definitionId().base());\n        if (idsForUpperBound == null) {\n            throw new RuntimeException(\"Could not find base id: \" + upperBound.definitionId().base());\n        }\n        IdAndDefinition resetValue = idsForUpperBound.getLast();\n        if (resetValue.definition().name().equals(ignoreDefinitionName)) {\n            // there must be another definition in this base since the ignored definition is new\n            assert idsForUpperBound.size() >= 2;\n            resetValue = idsForUpperBound.get(idsForUpperBound.size() - 2);\n        }\n        var resetUpperBound = new TransportVersionUpperBound(upperBound.name(), resetValue.definition().name(), resetValue.id());\n        resources.writeUpperBound(resetUpperBound);\n    }\n\n    private TransportVersionId maybeGetExistingId(\n        TransportVersionUpperBound upperBound,\n        TransportVersionDefinition existingDefinition,\n        String name\n    ) {\n        if (existingDefinition == null) {\n            // the name doesn't yet exist, so there is no id to return","sourceCodeStart":135,"sourceCodeEnd":171,"githubUrl":"https://github.com/elastic/elasticsearch/blob/db6a809a667c081ca1dc7500389d26975573215f/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/transport/AbstractGenerateTransportVersionDefinitionTask.java#L135-L171","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Inspect the upper-bound file referenced and its definitionId().base() value.","Cross-check that base against the definition files that populate idsByBase (look for a definition with that base).","Restore the missing definition from git, or remove the orphaned upper-bound entry.","Re-run on a clean checkout of the transport-version resources directory."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"List<IdAndDefinition> idsForUpperBound = idsByBase.get(upperBound.definitionId().base());\nif (idsForUpperBound == null) {\n    throw new IllegalStateException(\"Upper bound '\" + upperBound.name() + \"' references unknown base \" + upperBound.definitionId().base() + \"; available bases: \" + idsByBase.keySet());\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never hand-edit transport-version resource files; use the generator tasks.","Keep upper-bound and definition files in the same commit to avoid drift.","Run generation from a clean checkout to avoid partial states."],"tags":["transport-version","data-integrity","build-tooling","internal-invariant"],"backgroundTag":null,"analyzedSha":"db6a809a667c081ca1dc7500389d26975573215f","analyzedAt":"2026-08-12T01:39:14.192Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}