{"record":{"id":"9818e50fa98516ce","repo":"OtterMind/Chat2DB","slug":"unsupported-sundb-index-null-ordering-nullorder","errorCode":null,"errorMessage":"Unsupported SUNDB index null ordering: {nullOrder}","messagePattern":"Unsupported SUNDB index null ordering: (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"chat2db-community-server/chat2db-community-plugins/chat2db-community-sundb/src/main/java/ai/chat2db/plugin/sundb/SUNDBSqlGuards.java","lineNumber":118,"sourceCode":"        String normalized = StringUtils.trimToEmpty(constraintType).toUpperCase(Locale.ROOT);\n        if (CONSTRAINT_TYPES.contains(normalized)) {\n            return normalized;\n        }\n        throw new IllegalArgumentException(\"Unsupported SUNDB constraint type: \" + constraintType);\n    }\n\n    public static String requireNullOrder(String nullOrder) {\n        String normalized = StringUtils.trimToEmpty(nullOrder).toUpperCase(Locale.ROOT);\n        if (normalized.isEmpty()) {\n            return \"\";\n        }\n        if (\"NULLS FIRST\".equals(normalized) || \"NULL FIRST\".equals(normalized)) {\n            return \"NULLS FIRST\";\n        }\n        if (\"NULLS LAST\".equals(normalized) || \"NULL LAST\".equals(normalized)) {\n            return \"NULLS LAST\";\n        }\n        throw new IllegalArgumentException(\"Unsupported SUNDB index null ordering: \" + nullOrder);\n    }\n\n    private static void scanExpression(String expression, boolean typeExpression, String description) {\n        Deque<Character> parentheses = new ArrayDeque<>();\n        List<String> topLevelWords = new ArrayList<>();\n        boolean sawToken = false;\n        boolean topLevelLiteralEnded = false;\n        boolean intervalLiteralEnded = false;\n        boolean readingIntervalQualifier = false;\n        List<String> intervalQualifierWords = new ArrayList<>();\n\n        for (int i = 0; i < expression.length(); i++) {\n            char c = expression.charAt(i);\n            if (Character.isWhitespace(c)) {\n                continue;\n            }\n            sawToken = true;\n","sourceCodeStart":100,"sourceCodeEnd":136,"githubUrl":"https://github.com/OtterMind/Chat2DB/blob/5ee1e990e73fbcae1969dc554be254fedb3ab888/chat2db-community-server/chat2db-community-plugins/chat2db-community-sundb/src/main/java/ai/chat2db/plugin/sundb/SUNDBSqlGuards.java#L100-L136","documentation":"Thrown by SUNDBSqlGuards.requireNullOrder when an index null-ordering value, upper-cased and trimmed, is non-empty and not one of NULLS FIRST, NULL FIRST, NULLS LAST, or NULL LAST. An empty value is allowed (returns ''), so this only fires for a non-empty unrecognized value.","triggerScenarios":"Passing a non-empty null-ordering token other than the accepted spellings - e.g. 'FIRST', 'LAST', 'NULLS', or 'ASC'.","commonSituations":"UI/metadata supplying a partial value; cross-dialect import using plain FIRST/LAST; locale abbreviation.","solutions":["Use 'NULLS FIRST' or 'NULLS LAST' (NULL FIRST/NULL LAST are also accepted).","Leave the value empty/null to omit null ordering entirely.","Normalize FIRST->'NULLS FIRST' and LAST->'NULLS LAST' before building the index."],"exampleFix":"// before\ncol.setNullOrder(\"FIRST\");\n// -> Unsupported SUNDB index null ordering\n\n// after\ncol.setNullOrder(\"NULLS FIRST\");","handlingStrategy":"validation","validationCode":"Set<String> OK = Set.of(\"NULLS FIRST\", \"NULL FIRST\", \"NULLS LAST\", \"NULL LAST\");\nString n = StringUtils.trimToEmpty(nullOrder).toUpperCase(Locale.ROOT);\nif (!n.isEmpty() && !OK.contains(n)) {\n    throw new IllegalArgumentException(\"Reject SUNDB null ordering: \" + nullOrder);\n}","typeGuard":"static boolean isValidSundbNullOrder(String n) {\n    if (n == null || n.isBlank()) return true;\n    return Set.of(\"NULLS FIRST\", \"NULL FIRST\", \"NULLS LAST\", \"NULL LAST\").contains(n.trim().toUpperCase(Locale.ROOT));\n}","tryCatchPattern":null,"preventionTips":["Use NULLS FIRST / NULLS LAST, or leave empty.","Normalize FIRST/LAST to NULLS FIRST/NULLS LAST when importing.","Validate at the boundary."],"tags":["sundb","ddl","index","validation"],"backgroundTag":null,"analyzedSha":"5ee1e990e73fbcae1969dc554be254fedb3ab888","analyzedAt":"2026-08-14T07:05:03.077Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}