OtterMind/Chat2DB · error · CliDomainException

web.not.support.db.type

web.not.support.db.type

Error message

web.not.support.db.type

What it means

CliDomainException code web.not.support.db.type from validateCreate: in a non-desktop, release build (ConfigUtils.isDesktop()==false && isRelease()==true), creating a LocalFile H2 or SQLite datasource is blocked. These file-backed DBs are only permitted in the desktop edition to avoid unsafe server-side file DB exposure.

Source

Thrown at chat2db-community-server/chat2db-community-domain/chat2db-community-domain-core/src/main/java/ai/chat2db/community/domain/core/impl/cli/CliDataSourceServiceImpl.java:280

        } catch (Exception exception) {
            response.setCanConnect(Boolean.FALSE);
            response.setErrorCode("datasource_connection_failed");
            response.setErrorMessage(exception.getMessage());
        } finally {
            response.setDurationMs(System.currentTimeMillis() - startedAt);
        }
        return response;
    }

    private String firstNonBlank(String primary, String fallback) {
        return StringUtils.isNotBlank(primary) ? primary : fallback;
    }

    private void validateCreate(WorkspaceDataSource request) {
        if (!ConfigUtils.isDesktop() && ConfigUtils.isRelease()
                && "LocalFile".equalsIgnoreCase(request.getServiceType())
                && ("H2".equalsIgnoreCase(request.getType()) || "SQLite".equalsIgnoreCase(request.getType()))) {
            throw new CliDomainException("web.not.support.db.type", "web.not.support.db.type");
        }
    }

    private void enrichCreateResponse(CliDataSource response, CliDataSourceCreateRequest source) {
        if (response == null) {
            return;
        }
        if (StringUtils.isBlank(response.getAlias())) {
            response.setAlias(source.getAlias());
        }
        if ((StringUtils.isBlank(response.getHost()) || REDACTED.equals(response.getHost()))
                && StringUtils.isNotBlank(source.getHost())) {
            response.setHost(source.getHost());
        }
        if (StringUtils.isBlank(response.getPort()) && StringUtils.isNotBlank(source.getPort())) {
            response.setPort(source.getPort());
        }
        if (StringUtils.isBlank(response.getDatabase())) {

View on GitHub (pinned to 5ee1e990e7)

Solutions

  1. Use the Chat2DB desktop edition to work with LocalFile H2/SQLite datasources.
  2. On the web/release server, point to a server-hosted H2 (TCP) or a network DB instead of a LocalFile service type.
  3. If you genuinely need a file DB on the server, run a non-release/dev build (be aware of the security implications).

Example fix

// before (web release server)
create({ type:'H2', serviceType:'LocalFile', url:'jdbc:h2:file:./data', ... })

// after: connect to H2 over TCP or use desktop edition
create({ type:'H2', serviceType:'H2', url:'jdbc:h2:tcp://h2host:9092/data', ... })
Defensive patterns

Strategy: validation

Validate before calling

boolean webRelease = !ConfigUtils.isDesktop() && ConfigUtils.isRelease();
boolean blockedFileDb = "LocalFile".equalsIgnoreCase(request.getServiceType())
        && ("H2".equalsIgnoreCase(request.getType()) || "SQLite".equalsIgnoreCase(request.getType()));
if (webRelease && blockedFileDb) {
    throw new IllegalStateException("LocalFile H2/SQLite is desktop-only; use TCP or network DB on web");
}

Type guard

public boolean isWebReleaseBlockedFileDb(CliDataSourceCreateRequest r) {
    boolean webRelease = !ConfigUtils.isDesktop() && ConfigUtils.isRelease();
    boolean fileDb = "LocalFile".equalsIgnoreCase(r.getServiceType())
        && ("H2".equalsIgnoreCase(r.getType()) || "SQLite".equalsIgnoreCase(r.getType()));
    return webRelease && fileDb;
}

Try / catch

try {
    cliDataSourceService.create(request);
} catch (CliDomainException e) {
    if ("web.not.support.db.type".equals(e.getCode())) {
        return unsupportedOnWeb("LocalFile H2/SQLite requires the desktop edition");
    }
    throw e;
}

Prevention

When it happens

Trigger: Running the Community web/release server and attempting to create a datasource with serviceType=LocalFile and type H2 or SQLite.

Common situations: Operator tries to attach a local .mv.db or .sqlite file against a deployed (release) web server instead of the desktop app.

Related errors


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