{"record":{"id":"5156e0ed23c448d8","repo":"apache/dolphinscheduler","slug":"description-too-long-error-5156e0","errorCode":"DESCRIPTION_TOO_LONG_ERROR","errorMessage":"Status.DESCRIPTION_TOO_LONG_ERROR","messagePattern":"Status\\.DESCRIPTION_TOO_LONG_ERROR","errorType":"error_code","errorClass":"ServiceException","httpStatus":null,"severity":"warning","filePath":"dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/EnvironmentServiceImpl.java","lineNumber":105,"sourceCode":"     *\n     * @param loginUser login user\n     * @param name environment name\n     * @param config environment config\n     * @param desc environment desc\n     * @param workerGroups worker groups\n     */\n    @Override\n    @Transactional\n    public Long createEnvironment(User loginUser,\n                                  String name,\n                                  String config,\n                                  String desc,\n                                  String workerGroups) {\n        if (!canOperatorPermissions(loginUser, null, AuthorizationType.ENVIRONMENT, ENVIRONMENT_CREATE)) {\n            throw new ServiceException(Status.USER_NO_OPERATION_PERM);\n        }\n        if (checkDescriptionLength(desc)) {\n            throw new ServiceException(Status.DESCRIPTION_TOO_LONG_ERROR);\n        }\n        checkParams(name, config, workerGroups);\n\n        Environment environment = environmentMapper.queryByEnvironmentName(name);\n        if (environment != null) {\n            throw new ServiceException(Status.ENVIRONMENT_NAME_EXISTS, name);\n        }\n\n        Environment env = new Environment();\n        env.setName(name);\n        env.setConfig(config);\n        env.setDescription(desc);\n        env.setOperator(loginUser.getId());\n        env.setCreateTime(new Date());\n        env.setUpdateTime(new Date());\n        env.setCode(CodeGenerateUtils.genCode());\n\n        if (environmentMapper.insert(env) > 0) {","sourceCodeStart":87,"sourceCodeEnd":123,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/EnvironmentServiceImpl.java#L87-L123","documentation":"Thrown by EnvironmentServiceImpl.createEnvironment when the supplied environment description exceeds the configured maximum length (checkDescriptionLength returns true). DolphinScheduler limits environment descriptions to 255 characters (database column limit). The API rejects the create request before any insert occurs.","triggerScenarios":"POST /dolphinscheduler/environments with a 'description' form parameter longer than 255 characters; UI clients pasting long prose into the description field; scripts programmatically generating descriptions that exceed the limit.","commonSituations":"Automation tools writing generated configuration notes into the description field; users copying documentation text into the description box; clients not validating length client-side before submitting.","solutions":["Shorten the description parameter to 255 characters or fewer and retry the create call.","Truncate the description in the calling client before submitting (e.g. desc.substring(0, Math.min(desc.length(), 255))).","Move extended notes into external documentation and keep only a short summary in the description field."],"exampleFix":"// before\ndesc = longGeneratedText; // > 255 chars\nenvironmentService.createEnvironment(loginUser, name, config, desc, workerGroups);\n// after\ndesc = longGeneratedText.substring(0, Math.min(longGeneratedText.length(), 255));\nenvironmentService.createEnvironment(loginUser, name, config, desc, workerGroups);","handlingStrategy":"validation","validationCode":"public static void assertDescriptionLength(String desc) {\n    if (desc != null && desc.length() > 255) {\n        throw new IllegalArgumentException(\"Environment description exceeds 255 chars: \" + desc.length());\n    }\n}","typeGuard":"public static boolean isDescriptionValid(String desc) {\n    return desc == null || desc.length() <= 255;\n}","tryCatchPattern":"try {\n    environmentService.createEnvironment(loginUser, name, config, desc, workerGroups);\n} catch (ServiceException e) {\n    if (String.valueOf(e.getMessage()).contains(\"DESCRIPTION_TOO_LONG\")) {\n        desc = desc.substring(0, 255);\n        // retry once\n    }\n}","preventionTips":["Enforce maxLength=255 on the description input in UI forms and API clients","Truncate descriptions programmatically before any create/update call","Keep descriptions to short summaries; link to external docs for details"],"tags":["dolphinscheduler","validation","description-length","environment"],"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"}