{"record":{"id":"80e9ffe4f17d29ee","repo":"apache/dolphinscheduler","slug":"10001","errorCode":"10001","errorMessage":"request parameter {0} is not valid","messagePattern":"request parameter (.+?) is not valid","errorType":"validation","errorClass":"ServiceException","httpStatus":null,"severity":"warning","filePath":"dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/BaseController.java","lineNumber":49,"sourceCode":"\nimport java.text.MessageFormat;\nimport java.util.HashMap;\nimport java.util.Map;\n\nimport javax.servlet.http.HttpServletRequest;\n\npublic class BaseController {\n\n    /**\n     * check params\n     *\n     * @param pageNo   page number\n     * @param pageSize page size\n     * @throws ServiceException exception\n     */\n    public void checkPageParams(int pageNo, int pageSize) throws ServiceException {\n        if (pageNo <= 0) {\n            throw new ServiceException(Status.REQUEST_PARAMS_NOT_VALID_ERROR, Constants.PAGE_NUMBER);\n        }\n        if (pageSize <= 0) {\n            throw new ServiceException(Status.REQUEST_PARAMS_NOT_VALID_ERROR, Constants.PAGE_SIZE);\n        }\n    }\n\n    /**\n     * get ip address in the http request\n     *\n     * @param request http servlet request\n     * @return client ip address\n     */\n    public static String getClientIpAddress(HttpServletRequest request) {\n        String clientIp = request.getHeader(HTTP_X_FORWARDED_FOR);\n\n        if (StringUtils.isNotEmpty(clientIp) && !clientIp.equalsIgnoreCase(HTTP_HEADER_UNKNOWN)) {\n            int index = clientIp.indexOf(COMMA);\n            if (index != -1) {","sourceCodeStart":31,"sourceCodeEnd":67,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/BaseController.java#L31-L67","documentation":"BaseController.checkPageParams validates pagination parameters common to most list endpoints. It throws ServiceException with Status.REQUEST_PARAMS_NOT_VALID_ERROR (code 10001) and the parameter name ('pageNo') when pageNo is zero or negative. The message template 'request parameter {0} is not valid' is filled with 'pageNo'.","triggerScenarios":"Calling any paginated REST API (e.g. GET /projects/{code}/workflow-definitions) with pageNo<=0 in the query string.","commonSituations":"Client scripts defaulting page counters to 0; off-by-one loop that issues a request for page 0; UI sending uninitialized page state; API wrappers converting a 0-based page index directly.","solutions":["Pass pageNo >= 1 (pages are 1-based).","Clamp/default the page number client-side before the call (e.g. Math.max(1, pageNo)).","Handle the 10001 status code in the client and surface a 'page number must be positive' message instead of a raw failure."],"exampleFix":"// before\nGET /projects/1/workflow-definitions?pageNo=0&pageSize=10\n// after\nGET /projects/1/workflow-definitions?pageNo=1&pageSize=10","handlingStrategy":"validation","validationCode":"if (pageNo == null || pageNo <= 0) pageNo = 1;\n// then pass pageNo to the API call","typeGuard":null,"tryCatchPattern":"try {\n    result = client.listWorkflowDefinitions(projectCode, pageNo, pageSize);\n} catch (ServiceException e) {\n    if (e.getCode() == 10001) {\n        log.warn(\"Pagination rejected: {} — use 1-based pageNo\", e.getMessage());\n    }\n}","preventionTips":["Remember DolphinScheduler paging is 1-based.","Clamp page counters to >=1 in client wrappers.","Map status code 10001 to a friendly validation message."],"tags":["rest-api","pagination","invalid-query-parameter","validation"],"backgroundTag":"invalid-query-parameter","analyzedSha":"02eac45a1b6676e639fcbfb4be2243de5771b05d","analyzedAt":"2026-09-06T17:43:00.555Z","contentChangedAt":"2026-09-06T17:43:00.555Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}