{"record":{"id":"114e4c7b5c6f9ab0","repo":"alibaba/spring-ai-alibaba","slug":"invalid-status-114e4c","errorCode":null,"errorMessage":"Invalid status: ","messagePattern":"Invalid status: ","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"spring-ai-alibaba-admin/spring-ai-alibaba-admin-server-runtime/src/main/java/com/alibaba/cloud/ai/studio/runtime/enums/CommonStatus.java","lineNumber":71,"sourceCode":"\t/**\n\t * String representation of the status\n\t */\n\tprivate final String value;\n\n\t/**\n\t * Converts a numeric status code to its corresponding enum value\n\t * @param status numeric status code\n\t * @return corresponding CommonStatus enum value\n\t * @throws IllegalArgumentException if the status code is invalid\n\t */\n\tpublic static CommonStatus of(Integer status) {\n\t\tfor (CommonStatus commonStatus : CommonStatus.values()) {\n\t\t\tif (commonStatus.status.equals(status)) {\n\t\t\t\treturn commonStatus;\n\t\t\t}\n\t\t}\n\n\t\tthrow new IllegalArgumentException(\"Invalid status: \" + status);\n\t}\n\n}\n","sourceCodeStart":53,"sourceCodeEnd":75,"githubUrl":"https://github.com/alibaba/spring-ai-alibaba/blob/f82da0b50f35744c13968191be2b1cd2452ef550/spring-ai-alibaba-admin/spring-ai-alibaba-admin-server-runtime/src/main/java/com/alibaba/cloud/ai/studio/runtime/enums/CommonStatus.java#L53-L75","documentation":"CommonStatus.of() throws IllegalArgumentException when the given status string matches no CommonStatus enum constant. CommonStatus models generic enabled/disabled-style record states, and of() refuses unrecognized values.","triggerScenarios":"Calling CommonStatus.of(status) with a string that is null, empty, or not among the enum's value strings.","commonSituations":"Booleans (\"true\"/\"1\") passed instead of the expected status strings; numeric status codes from legacy schemas; case mismatches.","solutions":["Pass exactly one of the value strings defined by CommonStatus.","Normalize input (trim, case) before calling of().","Catch IllegalArgumentException at deserialization boundaries and surface a validation error.","Extend the enum if a genuinely new status is required."],"exampleFix":"// before\nCommonStatus st = CommonStatus.of(\"1\"); // throws\n// after\nCommonStatus st = CommonStatus.of(\"ENABLED\"); // match defined value","handlingStrategy":"validation","validationCode":"boolean valid = Arrays.stream(CommonStatus.values())\n    .anyMatch(s -> s.getStatus().equals(candidate));","typeGuard":"Optional<CommonStatus> tryCommonStatus(String s) {\n  try { return Optional.of(CommonStatus.of(s)); }\n  catch (IllegalArgumentException e) { return Optional.empty(); }\n}","tryCatchPattern":"try {\n  st = CommonStatus.of(raw);\n} catch (IllegalArgumentException e) {\n  throw new IllegalArgumentException(\"Unsupported status; use CommonStatus values\", e);\n}","preventionTips":["Use the enum constants' value strings, not booleans or numeric codes.","Normalize case/whitespace on strings from clients or legacy DB columns.","Serialize with the enum so status strings stay consistent end-to-end.","Guard of() calls with a validation helper at API boundaries."],"tags":["enum","illegal-argument"],"backgroundTag":"invalid-enum-value","analyzedSha":"f82da0b50f35744c13968191be2b1cd2452ef550","analyzedAt":"2026-09-09T15:32:42.421Z","contentChangedAt":"2026-09-09T15:32:42.421Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}