prestodb/presto · error · IllegalArgumentException

Invalid domain " + domain

Error message

Invalid domain " + domain

What it means

LarkSheetsApiFactory.toLarkDomain maps the configured 'domain' string to the Lark SDK Domain enum; any value other than 'lark' or 'feishu' (the LARK/FEISHU cases) falls into the default branch and throws IllegalArgumentException. This is a configuration validation failure, not a runtime/remote error.

Source

Thrown at presto-lark-sheets/src/main/java/com/facebook/presto/lark/sheets/api/LarkSheetsApiFactory.java:72

        drivePermissionService = new DrivePermissionService(config);
        sheetsService = new SheetsService(config);
    }

    @Override
    public LarkSheetsApi get()
    {
        return new SimpleLarkSheetsApi(drivePermissionService, sheetsService);
    }

    private static Domain toLarkDomain(LarkSheetsConfig.Domain domain)
    {
        switch (domain) {
            case LARK:
                return Domain.LarkSuite;
            case FEISHU:
                return Domain.FeiShu;
            default:
                throw new IllegalArgumentException("Invalid domain " + domain);
        }
    }
}

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Set domain to exactly 'lark' or 'feishu' (matching the switch cases).
  2. Check the catalog properties file (e.g. etc/catalog/lark_sheets.properties) for typos and casing.
  3. Consult LarkSheetsApiFactory/LARK/FEISHU constant definitions for accepted values.

Example fix

// before (catalog properties)
lark-sheets.domain=FeiShu

// after
lark-sheets.domain=feishu
Defensive patterns

Strategy: validation

Validate before calling

Set<String> VALID = Set.of("lark", "feishu");
if (domain == null || !VALID.contains(domain.toLowerCase(Locale.ROOT))) {
    throw new IllegalArgumentException("domain must be 'lark' or 'feishu'");
}

Type guard

boolean isValidDomain(String d) { return "lark".equalsIgnoreCase(d) || "feishu".equalsIgnoreCase(d); }

Try / catch

try { api = LarkSheetsApiFactory.create(config); } catch (IllegalArgumentException e) { if (e.getMessage().startsWith("Invalid domain")) { fixConfigFile(); } else { throw e; } }

Prevention

When it happens

Trigger: Setting the lark-sheets 'lark-sheets.domain' config property to an unrecognized string (anything other than the LARK/FEISHU enum values, matched via switch), then building the API factory via config().

Common situations: Typo in the config file ('LarkSuite', 'feishu.cn', 'larksuite.com'); wrong casing if matching is case-sensitive; copy-pasting config from a different connector.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04). Data as JSON: /api/errors/c418279a1b12dff1. Report an issue: GitHub.