{"record":{"id":"95c6320530a96910","repo":"quarkusio/quarkus","slug":"invalid-tag-entry-expected-key-value","errorCode":null,"errorMessage":"Invalid tag: {{entry}} (expected key=value)","messagePattern":"Invalid tag: (.+?)\\} \\(expected key=value\\)","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"extensions/micrometer/runtime/src/main/java/io/quarkus/micrometer/runtime/binder/virtualthreads/VirtualThreadCollector.java","lineNumber":83,"sourceCode":"     *\n     * @param tags the tags.\n     * @return the binder, {@code null} if the instantiation failed.\n     */\n    public MeterBinder instantiate(List<Tag> tags) {\n        try {\n            Class<?> clazz = Class.forName(VIRTUAL_THREAD_BINDER_CLASSNAME);\n            return (MeterBinder) clazz.getDeclaredConstructor(Iterable.class).newInstance(tags);\n        } catch (Exception e) {\n            throw new IllegalStateException(\"Failed to instantiate \" + VIRTUAL_THREAD_BINDER_CLASSNAME, e);\n        }\n    }\n\n    private Tag createTagFromEntry(String entry) {\n        String[] parts = entry.trim().split(\"=\");\n        if (parts.length == 2) {\n            return Tag.of(parts[0], parts[1]);\n        } else {\n            throw new IllegalStateException(\"Invalid tag: \" + entry + \" (expected key=value)\");\n        }\n    }\n\n    public MeterBinder getBinder() {\n        return binder;\n    }\n\n    public List<Tag> getTags() {\n        return tags;\n    }\n\n    public void init(@Observes StartupEvent event) {\n        if (enabled && binder != null) {\n            binder.bindTo(registry);\n        }\n    }\n\n    public void close(@Observes ShutdownEvent event) {","sourceCodeStart":65,"sourceCodeEnd":101,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/micrometer/runtime/src/main/java/io/quarkus/micrometer/runtime/binder/virtualthreads/VirtualThreadCollector.java#L65-L101","documentation":"VirtualThreadCollector parses JVM virtual-thread event tags from string entries and expects each entry in 'key=value' form. When a split on '=' does not yield exactly two parts, the collector cannot build a Micrometer Tag and throws IllegalStateException to fail fast rather than emit a malformed metric tag.","triggerScenarios":"Calling createTagFromEntry (directly or via the collector's binder) with an entry string that has no '=', more than one '=', or an empty value such as 'keyOnly', 'a=b=c', or '=value'.","commonSituations":"Feeding custom or whitespace-padded event labels into the virtual-thread metrics collector; passing entries copied from a different format (e.g. JSON 'key: value'); manual tag construction in tests.","solutions":["Ensure each entry contains exactly one '=' separating a non-empty key and value","Trim the entry before passing it (the method trims internally, but '=b' or 'a=' still fails)","Filter out malformed entries before building tags, e.g. entries.stream().filter(e -> e.indexOf('=')>0)","Log or skip unparseable entries instead of passing them to the collector"],"exampleFix":"// before\nTag tag = createTagFromEntry(\"threadName-12\"); // throws\n// after\nString entry = \"threadName-12\";\nif (entry.indexOf('=') > 0) {\n    Tag tag = createTagFromEntry(entry);\n} else {\n    // skip or log\n}","handlingStrategy":"validation","validationCode":"boolean isValidTagEntry(String entry) {\n    String t = entry == null ? \"\" : entry.trim();\n    int i = t.indexOf('=');\n    return i > 0 && i < t.length() - 1 && t.indexOf('=', i + 1) == -1;\n}","typeGuard":"boolean isWellFormedKeyValue(String s) {\n    return s != null && s.trim().split(\"=\").length == 2 && s.contains(\"=\");\n}","tryCatchPattern":"try {\n    Tag tag = createTagFromEntry(entry);\n} catch (IllegalStateException e) {\n    log.warnf(\"Skipping malformed tag entry: %s\", entry);\n}","preventionTips":["Validate entries contain exactly one '=' before feeding the collector","Trim and normalize label sources before tag creation","Write a unit test covering keyOnly, a=b=c and empty-value inputs"],"tags":["micrometer","metrics","parsing","virtual-threads"],"backgroundTag":"malformed-key-value-pair","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"}