{"record":{"id":"27871a595fe70ff0","repo":"alibaba/spring-ai-alibaba","slug":"unknown-dataset-status-code","errorCode":null,"errorMessage":"Unknown dataset status code: ","messagePattern":"Unknown dataset status code: ","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"spring-ai-alibaba-admin/spring-ai-alibaba-admin-server-start/src/main/java/com/alibaba/cloud/ai/studio/admin/enums/versionStatus.java","lineNumber":39,"sourceCode":"        this.code = code;\n        this.description = description;\n    }\n\n    public String getCode() {\n        return code;\n    }\n\n    public String getDescription() {\n        return description;\n    }\n\n    public static versionStatus fromCode(String code) {\n        for (versionStatus status : values()) {\n            if (status.getCode().equals(code)) {\n                return status;\n            }\n        }\n        throw new IllegalArgumentException(\"Unknown dataset status code: \" + code);\n    }\n} \n","sourceCodeStart":21,"sourceCodeEnd":42,"githubUrl":"https://github.com/alibaba/spring-ai-alibaba/blob/f82da0b50f35744c13968191be2b1cd2452ef550/spring-ai-alibaba-admin/spring-ai-alibaba-admin-server-start/src/main/java/com/alibaba/cloud/ai/studio/admin/enums/versionStatus.java#L21-L42","documentation":"versionStatus.fromCode(String) maps a dataset-version status code to the enum and throws IllegalArgumentException \"Unknown dataset status code: X\" when no constant's code matches. Like the other fromCode guards, it prevents silently creating a bogus enum value from unrecognized data.","triggerScenarios":"Calling versionStatus.fromCode() with a code absent from the enum, e.g. a corrupted or legacy dataset-version row, a typo in persisted data, or a code written by a newer/older app version.","commonSituations":"Schema evolution where status codes were renamed; importing dataset versions from another environment; clients sending unexpected status strings; case mismatch in stored codes.","solutions":["Log the offending code and compare against the codes defined in versionStatus.","Correct the data (DB record or payload) to a valid code.","Add the missing constant if the code is a legitimate new status.","Normalize (trim/lowercase) input before comparison if stored codes vary in format.","Provide a default mapping for legacy codes instead of throwing."],"exampleFix":"// before\nthrow new IllegalArgumentException(\"Unknown dataset status code: \" + code);\n// after\nreturn Arrays.stream(values()).filter(s -> s.getCode().equalsIgnoreCase(code)).findFirst()\n    .orElseThrow(() -> new IllegalArgumentException(\"Unknown dataset status code: \" + code + \", valid: \" + Arrays.toString(values())));","handlingStrategy":"try-catch","validationCode":"boolean valid = Arrays.stream(versionStatus.values())\n    .anyMatch(s -> s.getCode().equals(code));","typeGuard":null,"tryCatchPattern":"try { st = versionStatus.fromCode(code); } catch (IllegalArgumentException e) { log.warn(\"Unknown dataset status '{}'\", code); st = versionStatus.DRAFT; }","preventionTips":["Keep status codes written only through the enum's getCode()","Add a data-migration step when renaming status codes","Normalize/trim external input before fromCode","Add an integration test round-tripping every constant through fromCode"],"tags":["enum","invalid-value","status-code","dataset","java"],"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"}