{"record":{"id":"06ee8c4363b47d0c","repo":"pinpoint-apm/pinpoint","slug":"invalid-uri-stat-chart-type","errorCode":null,"errorMessage":"Invalid uri stat chart type: ","messagePattern":"Invalid uri stat chart type: ","errorType":"exception","errorClass":"NoSuchElementException","httpStatus":null,"severity":"error","filePath":"uristat/uristat-web/src/main/java/com/navercorp/pinpoint/uristat/web/chart/UriStatChartTypeFactory.java","lineNumber":28,"sourceCode":"import java.util.stream.Collectors;\n\n@Component\npublic class UriStatChartTypeFactory {\n    private final Map<String, UriStatChartType> uriStatCharts;\n\n    public UriStatChartTypeFactory(UriStatChartType... uriStatCharts) {\n        Objects.requireNonNull(uriStatCharts, \"uriStatCharts\");\n\n        this.uriStatCharts = Arrays.stream(uriStatCharts)\n                .collect(Collectors.toMap(UriStatChartType::getType, Function.identity()));\n    }\n\n    public UriStatChartType valueOf(String type) {\n        Objects.requireNonNull(type);\n\n        final UriStatChartType uriStatChartType = uriStatCharts.get(type);\n        if (uriStatChartType == null) {\n            throw new NoSuchElementException(\"Invalid uri stat chart type: \" + type);\n        }\n        return uriStatChartType;\n    }\n}\n","sourceCodeStart":10,"sourceCodeEnd":33,"githubUrl":"https://github.com/pinpoint-apm/pinpoint/blob/744c3d3075e595656abb1ae331ad2c0e4c9eb996/uristat/uristat-web/src/main/java/com/navercorp/pinpoint/uristat/web/chart/UriStatChartTypeFactory.java#L10-L33","documentation":"UriStatChartTypeFactory.valueOf looks up the type string in a prebuilt map of UriStatChartType instances and throws NoSuchElementException when the key is absent. It is a strict lookup: unlike enum valueOf it accepts custom type strings but must know them at registration time.","triggerScenarios":"Calling valueOf with a type string never registered in the factory's uriStatCharts map (or a typo / different case).","commonSituations":"Frontend sending a chart type parameter the backend version doesn't support; version mismatch between web UI and uristat-web module; renamed chart types.","solutions":["Use a chart type string supported by this build (check the keys registered in UriStatChartTypeFactory).","Align frontend and backend versions so both know the same chart types.","Handle NoSuchElementException in the controller and return a 404/400 listing valid types."],"exampleFix":"// before\nUriStatChartType t = factory.valueOf(\"bogusType\");\n// after\nUriStatChartType t = factory.valueOf(\"cpu\"); // a registered type key","handlingStrategy":"try-catch","validationCode":"UriStatChartType t = null; /* pre-check against the registered keys of uriStatCharts if exposed, else use try-catch */","typeGuard":null,"tryCatchPattern":"try { t = factory.valueOf(type); } catch (NoSuchElementException e) { t = defaultChartType; }","preventionTips":["Keep client chart-type constants in sync with server registry","Share the type list between modules","Add tests covering all types sent by the frontend"],"tags":["uristat","chart-type","no-such-element"],"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"}