{"record":{"id":"609b6694b15b1b5d","repo":"apache/dolphinscheduler","slug":"1400004","errorCode":"1400004","errorMessage":"description is too long error","messagePattern":"description is too long error","errorType":"error_code","errorClass":"ServiceException","httpStatus":null,"severity":"warning","filePath":"dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ClusterServiceImpl.java","lineNumber":228,"sourceCode":"     *\n     * @param loginUser login user\n     * @param code      cluster code\n     * @param name      cluster name\n     * @param config    cluster config\n     * @param desc      cluster desc\n     */\n    @Override\n    public Cluster updateClusterByCode(User loginUser,\n                                       Long code,\n                                       String name,\n                                       String config,\n                                       String desc) {\n        if (isNotAdmin(loginUser)) {\n            throw new ServiceException(Status.USER_NO_OPERATION_PERM);\n        }\n\n        if (checkDescriptionLength(desc)) {\n            throw new ServiceException(Status.DESCRIPTION_TOO_LONG_ERROR);\n        }\n\n        checkParams(name, config);\n\n        Cluster clusterExistByName = clusterDao.queryByClusterName(name);\n        if (clusterExistByName != null && !clusterExistByName.getCode().equals(code)) {\n            throw new ServiceException(Status.CLUSTER_NAME_EXISTS, name);\n        }\n\n        Cluster clusterExist = clusterDao.queryByClusterCode(code);\n        if (clusterExist == null) {\n            throw new ServiceException(Status.CLUSTER_NOT_EXISTS, name);\n        }\n\n        if (!Constants.K8S_LOCAL_TEST_CLUSTER_CODE.equals(clusterExist.getCode())\n                && !config.equals(ClusterConfUtils.getK8sConfig(clusterExist.getConfig()))) {\n            try {\n                k8sManager.getAndUpdateK8sClient(code, true);","sourceCodeStart":210,"sourceCodeEnd":246,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ClusterServiceImpl.java#L210-L246","documentation":"updateClusterByCode validates the cluster description length via checkDescriptionLength(desc); when the description exceeds the allowed maximum it throws ServiceException(Status.DESCRIPTION_TOO_LONG_ERROR, code 1400004). This is a simple input-size validation on the desc field of the cluster update request.","triggerScenarios":"PUT /clusters/{code} (or updateClusterByCode) called with a desc string longer than the configured limit (Constants.DESCRIPTION length, 255 chars by default schema).","commonSituations":"Pasting long runbooks/notes into the cluster description field; scripts writing markdown docs into desc; UI clients not enforcing maxlength.","solutions":["Shorten the description to under the maximum length (255 characters for the default schema).","Store long documentation externally (wiki/link) and keep only a short summary in desc.","Truncate the description programmatically before calling the API.","If longer descriptions are genuinely needed, alter the column size and update the limit in code."],"exampleFix":"// before\ndesc = veryLongMarkdown;\nclusterService.updateClusterByCode(loginUser, code, name, config, desc);\n// after\nif (desc != null && desc.length() > 255) {\n    desc = desc.substring(0, 255);\n}\nclusterService.updateClusterByCode(loginUser, code, name, config, desc);","handlingStrategy":"validation","validationCode":"// Java\nif (desc != null && desc.length() > 255) {\n    throw new IllegalArgumentException(\"description must be <= 255 chars, got \" + desc.length());\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Enforce maxlength on description inputs in the UI","Truncate or summarize descriptions programmatically","Keep long docs in external systems and link them"],"tags":["validation","input-length","cluster"],"backgroundTag":"value-out-of-range","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"}