{"record":{"id":"6dd9b03658058326","repo":"pagehelper-org/Mybatis-PageHelper","slug":"the-pagination-query-parameter-failed-to-be-proces","errorCode":null,"errorMessage":"The pagination query parameter failed to be processed!","messagePattern":"The pagination query parameter failed to be processed!","errorType":"exception","errorClass":"PageException","httpStatus":null,"severity":"error","filePath":"src/main/java/com/github/pagehelper/util/PageObjectUtil.java","lineNumber":104,"sourceCode":"                    page.setOrderByOnly(true);\n                }\n            }\n            return page;\n        }\n        int pageNum;\n        int pageSize;\n        MetaObject paramsObject = null;\n        if (hasRequest && requestClass.isAssignableFrom(params.getClass())) {\n            try {\n                paramsObject = MetaObjectUtil.forObject(getParameterMap.invoke(params, new Object[]{}));\n            } catch (Exception e) {\n                //忽略\n            }\n        } else {\n            paramsObject = MetaObjectUtil.forObject(params);\n        }\n        if (paramsObject == null) {\n            throw new PageException(\"The pagination query parameter failed to be processed!\");\n        }\n        Object orderBy = getParamValue(paramsObject, \"orderBy\", false);\n        boolean hasOrderBy = false;\n        if (orderBy != null && orderBy.toString().length() > 0) {\n            hasOrderBy = true;\n        }\n        try {\n            Object _pageNum = getParamValue(paramsObject, \"pageNum\", required);\n            Object _pageSize = getParamValue(paramsObject, \"pageSize\", required);\n            if (_pageNum == null || _pageSize == null) {\n                if(hasOrderBy){\n                    Page page = new Page();\n                    page.setOrderBy(orderBy.toString());\n                    page.setOrderByOnly(true);\n                    return page;\n                }\n                return null;\n            }","sourceCodeStart":86,"sourceCodeEnd":122,"githubUrl":"https://github.com/pagehelper-org/Mybatis-PageHelper/blob/c692616c5bc95b41aa779b502f991825c8e5acbc/src/main/java/com/github/pagehelper/util/PageObjectUtil.java#L86-L122","documentation":"PageHelper tried to wrap the supplied pagination parameter into a MetaObject for reflective property access, but the resulting MetaObject came back null. This means the params object type could not be processed (neither Map, IPage, nor a reflectively accessible bean). The library throws PageException because it cannot read pageNum/pageSize/orderBy properties from it.","triggerScenarios":"Passing an exotic object (primitive wrapper, String, array, or type with no accessible properties) as the paging parameter object to startPage(params); a custom parameter wrapper whose type is not supported by MetaObjectUtil.forObject; calling getPageFromObject directly with an unsupported type.","commonSituations":"Passing a JSON string or Integer instead of a Map/bean to the paging overload; after upgrading PageHelper, previously tolerated parameter types now fail MetaObject creation; using a custom Page-like class that the library does not recognize and that reflection cannot expose.","solutions":["Pass a supported parameter type: a java.util.Map with pageNum/pageSize keys, an IPage implementation, or a plain bean with pageNum/pageSize getters","Inspect the object actually passed at the call site and log its class to find the unsupported type","Convert exotic types to a Map before paging (e.g. objectMapper.convertValue(dto, Map.class))","Update PageHelper if the type used to work — check the version's supported parameter types in PageObjectUtil"],"exampleFix":"// before\nPageHelper.startPage(someString);\n// after\nMap<String, Object> params = new HashMap<>();\nparams.put(\"pageNum\", pageNum);\nparams.put(\"pageSize\", pageSize);\nPageHelper.startPage(params);","handlingStrategy":"type-guard","validationCode":"if (!(params instanceof Map || params instanceof IPage)) {\n    throw new IllegalArgumentException(\n        \"paging params must be Map, IPage, or a bean, got: \"\n        + (params == null ? \"null\" : params.getClass().getName()));\n}","typeGuard":"boolean isSupportedPagingParam(Object p) {\n    return p instanceof Map || p instanceof IPage\n        || (p != null && !p.getClass().isPrimitive()\n            && !p.getClass().isArray()\n            && !(p instanceof String));\n}","tryCatchPattern":"try {\n    PageHelper.startPage(params);\n} catch (PageException e) {\n    log.error(\"unsupported paging param type {}: {}\",\n        params == null ? null : params.getClass(), e.getMessage());\n}","preventionTips":["Only pass Map, IPage, or POJOs with getters to the paging API","Never pass Strings, wrappers, or arrays as paging parameter objects","Convert request DTOs to Maps via Jackson if reflection access is uncertain"],"tags":["pagination","reflection","type-mismatch","mybatis","pagehelper"],"backgroundTag":"type-mismatch","analyzedSha":"c692616c5bc95b41aa779b502f991825c8e5acbc","analyzedAt":"2026-09-08T03:50:49.192Z","contentChangedAt":"2026-09-08T03:50:49.192Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}