{"record":{"id":"118d5990c4d975f5","repo":"quarkusio/quarkus","slug":"failed-to-compose-an-error-message","errorCode":null,"errorMessage":"Failed to compose an error message","messagePattern":"Failed to compose an error message","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"warning","filePath":"independent-projects/tools/registry-client/src/main/java/io/quarkus/registry/client/maven/MavenRegistryClientFactory.java","lineNumber":517,"sourceCode":"            appendRepoInfo(writer, repos.get(0));\n            for (int i = 1; i < repos.size(); ++i) {\n                writer.append(\", \");\n                appendRepoInfo(writer, repos.get(i));\n            }\n        } catch (IOException e1) {\n            buf.append(e.getLocalizedMessage());\n        }\n        return buf.toString();\n    }\n\n    private static void appendRepoInfo(Appendable writer, RemoteRepository repo) {\n        try {\n            writer.append(repo.getId());\n            writer.append(\" (\");\n            writer.append(repo.getUrl());\n            writer.append(\")\");\n        } catch (Exception e) {\n            throw new RuntimeException(\"Failed to compose an error message\", e);\n        }\n    }\n\n    private static boolean areMatching(final List<RemoteRepository> registryRepos,\n            final List<RemoteRepository> aggregatedRepos) {\n        if (registryRepos.size() != aggregatedRepos.size()) {\n            return false;\n        }\n        for (int i = 0; i < registryRepos.size(); ++i) {\n            final RemoteRepository original = registryRepos.get(i);\n            final RemoteRepository aggregated = aggregatedRepos.get(i);\n            if (!original.getId().equals(aggregated.getId()) || !original.getUrl().equals(aggregated.getUrl())) {\n                return false;\n            }\n        }\n        return true;\n    }\n}","sourceCodeStart":499,"sourceCodeEnd":535,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/tools/registry-client/src/main/java/io/quarkus/registry/client/maven/MavenRegistryClientFactory.java#L499-L535","documentation":"A defensive wrapper error: while building a human-readable message describing which repository/mirror failed resolution (appendRepoInfo), an unexpected exception (e.g. null repo id/url) was hit. The original resolution failure is preserved as the cause.","triggerScenarios":"getDescriptorResolutionFailureMessage or getDescriptorResolutionFailureFromMirrorMessage formatting a RemoteRepository whose getId() or getUrl() throws or yields data that makes StringBuilder.append fail — practically only with null/odd repo objects from a resolver session.","commonSituations":"Mirrors or aggregated repositories returning incomplete RemoteRepository instances in exotic resolver setups; debugging sessions with custom repository implementations.","solutions":["Look at the cause of this RuntimeException for the real formatting failure and at the outer message for the original resolution problem","Verify repositories/mirrors configured in settings.xml have both id and url set","If it persists, report it upstream with the full exception chain"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { client = factory.buildRegistryClient(cfg); } catch (RuntimeException e) { if (e.getMessage().equals(\"Failed to compose an error message\")) { log.error(\"Repository info formatting failed; see cause and original resolution failure\", e); } else throw e; }","preventionTips":["Ensure repositories/mirrors in settings.xml have id and url set","Avoid custom RemoteRepository implementations with null metadata","Inspect the full exception chain when this wrapper appears"],"tags":["diagnostics","maven","mirror"],"backgroundTag":"error-message-composition-failure","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}