OtterMind/Chat2DB · error · IllegalArgumentException

Unsupported Oracle VARCHAR unit

Error message

Unsupported Oracle VARCHAR unit: {unit}

What it means

Error "Unsupported Oracle VARCHAR unit: {unit}" thrown in OtterMind/Chat2DB.

Solutions

  1. Use BYTE or CHAR as the VARCHAR length unit for Oracle.
  2. Remove the unit or correct it in the column definition.

When it happens

Trigger: An Oracle VARCHAR column definition used a length unit other than BYTE or CHAR.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at chat2db-community-server/chat2db-community-plugins/chat2db-community-oracle/src/main/java/ai/chat2db/plugin/oracle/OracleSqlGuards.java:61

    public static String requireColumnTypeExpression(String typeName) {
        if (StringUtils.isBlank(typeName)) {
            throw invalid("column type", typeName);
        }
        scanExpression(typeName.trim(), true, "column type");
        return typeName;
    }

    /**
     * Backward-compatible name retained for the existing Oracle call sites.
     */
    public static String requireSafeTypeName(String typeName) {
        return requireColumnTypeExpression(typeName);
    }

    public static String requireUnit(String unit) {
        String trimmed = StringUtils.trimToEmpty(unit);
        if (!"CHAR".equalsIgnoreCase(trimmed) && !"BYTE".equalsIgnoreCase(trimmed)) {
            throw new IllegalArgumentException("Unsupported Oracle VARCHAR unit: " + unit);
        }
        return trimmed;
    }

    public static String requireAscOrDesc(String value) {
        String trimmed = StringUtils.trimToEmpty(value);
        if ("ASC".equalsIgnoreCase(trimmed)) {
            return "ASC";
        }
        if ("DESC".equalsIgnoreCase(trimmed)) {
            return "DESC";
        }
        throw new IllegalArgumentException("Invalid Oracle index sort direction: " + value);
    }

    /**
     * Returns the raw hex digits represented by {@code value}. Non-hex input is
     * replaced with the caller-provided base16 encoding, which is verified too.

View on GitHub (pinned to 5ee1e990e7)