OtterMind/Chat2DB · error · IllegalArgumentException

Invalid Oscar sort order: ${ascOrDesc}

Error message

Invalid Oscar sort order: ${ascOrDesc}

What it means

Error "Invalid Oscar sort order: ${ascOrDesc}" thrown in OtterMind/Chat2DB.

Source

Thrown at chat2db-community-server/chat2db-community-plugins/chat2db-community-oscar/src/main/java/ai/chat2db/plugin/oscar/OscarSqlGuards.java:146

     * Validates a CHAR/VARCHAR length unit (BYTE/CHAR) emitted verbatim into DDL.
     */
    public static String requireLengthUnit(String unit) {
        if (StringUtils.isBlank(unit)) {
            throw new IllegalArgumentException("Invalid Oscar length unit: " + unit);
        }
        String value = unit.trim();
        if ("BYTE".equalsIgnoreCase(value) || "CHAR".equalsIgnoreCase(value)) {
            return value;
        }
        throw new IllegalArgumentException("Invalid Oscar length unit: " + unit);
    }

    /**
     * Validates an index column sort order (ASC/DESC) emitted verbatim into DDL.
     */
    public static String requireSortOrder(String ascOrDesc) {
        if (StringUtils.isBlank(ascOrDesc)) {
            throw new IllegalArgumentException("Invalid Oscar sort order: " + ascOrDesc);
        }
        String value = ascOrDesc.trim();
        if ("ASC".equalsIgnoreCase(value) || "DESC".equalsIgnoreCase(value)) {
            return value;
        }
        throw new IllegalArgumentException("Invalid Oscar sort order: " + ascOrDesc);
    }

    /**
     * Validates one complete Oscar column type expression, including parameterized
     * built-in types and schema-qualified or quoted user-defined types.
     */
    public static String requireColumnTypeExpression(String columnType) {
        String value = StringUtils.trimToNull(columnType);
        if (value == null) {
            throw invalidColumnType(columnType);
        }
        Deque<Character> parentheses = new ArrayDeque<>();

View on GitHub (pinned to 5ee1e990e7)

Solutions

  1. Use ASC or DESC for the index column sort order.

When it happens

Trigger: An Oscar index column had an invalid sort order value.

Common situations: See trigger scenarios.


AI-assisted analysis of OtterMind/Chat2DB@5ee1e990e7 (2026-08-14). Data as JSON: /api/errors/f71ad6c990c9e0eb. Report an issue: GitHub.