{"record":{"id":"825fad0f4d879eb6","repo":"elastic/elasticsearch","slug":"file-branches-json-has-not-been-found-in-path","errorCode":null,"errorMessage":"File branches.json has not been found in {path}","messagePattern":"File branches\\.json has not been found in (.+?)","errorType":"validation","errorClass":"InvalidUserDataException","httpStatus":null,"severity":"error","filePath":"build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/release/UpdateBranchesJsonTask.java","lineNumber":166,"sourceCode":"\n        JsonNode jsonNode = objectMapper.readTree(new FileInputStream(branchesFile));\n        ArrayNode updatedBranches = objectMapper.createArrayNode();\n        for (DevelopmentBranch branch : developmentBranches) {\n            ObjectNode objectNode = objectMapper.createObjectNode();\n            objectNode.put(\"branch\", branch.name());\n            objectNode.put(\"version\", branch.version().toString());\n            updatedBranches.add(objectNode);\n        }\n        ((ObjectNode) jsonNode).replace(\"branches\", updatedBranches);\n\n        DefaultPrettyPrinter prettyPrinter = new DefaultPrettyPrinter();\n        prettyPrinter.indentArraysWith(new DefaultIndenter(\"  \", DefaultIndenter.SYS_LF));\n        objectMapper.writer(prettyPrinter).writeValue(branchesFile, jsonNode);\n    }\n\n    private List<DevelopmentBranch> readBranches(File branchesFile) {\n        if (branchesFile.isFile() == false) {\n            throw new InvalidUserDataException(\"File branches.json has not been found in \" + branchesFile.getAbsolutePath());\n        }\n\n        try {\n            byte[] branchesBytes = Files.readAllBytes(branchesFile.toPath());\n            return branchesFileParser.parse(branchesBytes);\n        } catch (IOException e) {\n            throw new UncheckedIOException(\"Failed to read branches.json from \" + branchesFile.getPath(), e);\n        }\n    }\n}\n","sourceCodeStart":148,"sourceCodeEnd":177,"githubUrl":"https://github.com/elastic/elasticsearch/blob/db6a809a667c081ca1dc7500389d26975573215f/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/release/UpdateBranchesJsonTask.java#L148-L177","documentation":"Thrown by UpdateBranchesJsonTask.readBranches() when branchesFile does not exist or is not a regular file. The task cannot read or modify branches.json without it.","triggerScenarios":"The configured branchesFile path does not resolve to an existing file — wrong working directory, the file was deleted, or the path property was never set correctly.","commonSituations":"Running the task from the wrong working directory; branches.json was never created in this checkout; the path was overridden by a misconfigured property.","solutions":["Confirm branches.json exists at the expected location (typically the project root / docs resources).","Run the Gradle invocation from the repository root so the relative path resolves.","Restore branches.json from git if it was deleted."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Verify branches.json resolves to a file before running the task\nPath branches = rootDir.resolve(\"branches.json\");\nif (!Files.isRegularFile(branches)) {\n    throw new GradleException(\"branches.json missing at \" + branches);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run release tasks from the repository root.","Treat branches.json as a tracked artifact; never delete it."],"tags":["release-tooling","gradle-task","missing-file","branches-json"],"backgroundTag":null,"analyzedSha":"db6a809a667c081ca1dc7500389d26975573215f","analyzedAt":"2026-08-12T01:39:14.192Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}