{"record":{"id":"2335a1c401b349f3","repo":"pinpoint-apm/pinpoint","slug":"unknown-value-2335a1","errorCode":null,"errorMessage":"Unknown value : ","messagePattern":"Unknown value : ","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"metric-module/metric/src/main/java/com/navercorp/pinpoint/metric/web/model/basic/metric/group/MatchingRule.java","lineNumber":52,"sourceCode":"        return value;\n    }\n\n    public static MatchingRule getByCode(int code) {\n        for (MatchingRule matchingRule : MatchingRule.values()) {\n            if (matchingRule.code == code) {\n                return matchingRule;\n            }\n        }\n        throw new IllegalArgumentException(\"Unknown code : \" + code);\n    }\n\n    public static MatchingRule getByValue(String value) {\n        for (MatchingRule matchingRule : MatchingRule.values()) {\n            if (matchingRule.value.equalsIgnoreCase(value)) {\n                return matchingRule;\n            }\n        }\n        throw new IllegalArgumentException(\"Unknown value : \" + value);\n    }\n}\n","sourceCodeStart":34,"sourceCodeEnd":55,"githubUrl":"https://github.com/pinpoint-apm/pinpoint/blob/744c3d3075e595656abb1ae331ad2c0e4c9eb996/metric-module/metric/src/main/java/com/navercorp/pinpoint/metric/web/model/basic/metric/group/MatchingRule.java#L34-L55","documentation":"MatchingRule.getByValue throws IllegalArgumentException when the given string does not case-insensitively equal the value of any MatchingRule enum constant. It is the string-based lookup counterpart of getByCode and accepts only known enum values.","triggerScenarios":"Calling MatchingRule.getByValue with a misspelled or unsupported rule value string, or one from a mismatched API version — typically a request parameter specifying how metric tags should be matched.","commonSituations":"Typo in query parameter values like 'exact'/'contain' variants; frontend/backend version skew; copying example values from outdated documentation.","solutions":["Use a value that exactly matches one of MatchingRule.values()' value fields (case-insensitive).","Validate the input against the enum before lookup, or expose the valid values in API docs.","Catch IllegalArgumentException and fall back to a default MatchingRule.","If a new matching semantic is needed, add a new enum constant."],"exampleFix":"// before\nMatchingRule rule = MatchingRule.getByValue(request.getParameter(\"matchingRule\"));\n\n// after\nString v = request.getParameter(\"matchingRule\");\nMatchingRule rule;\ntry {\n    rule = MatchingRule.getByValue(v);\n} catch (IllegalArgumentException e) {\n    rule = MatchingRule.DEFAULT;\n}","handlingStrategy":"try-catch","validationCode":"boolean valid = Arrays.stream(MatchingRule.values())\n    .anyMatch(r -> r.value.equalsIgnoreCase(candidate));","typeGuard":null,"tryCatchPattern":"try {\n    rule = MatchingRule.getByValue(value);\n} catch (IllegalArgumentException e) {\n    rule = MatchingRule.DEFAULT;\n}","preventionTips":["Expose valid matchingRule values via a metadata endpoint instead of hardcoding strings in clients.","Normalize input (trim, lowercase) before lookup.","Add unit tests covering every enum value round-tripping through getByValue."],"tags":["enum","argument-validation","metrics-web"],"backgroundTag":"invalid-enum-value","analyzedSha":"744c3d3075e595656abb1ae331ad2c0e4c9eb996","analyzedAt":"2026-09-07T18:48:45.289Z","contentChangedAt":"2026-09-07T18:48:45.289Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}