OtterMind/Chat2DB · warning · BusinessException
file.type.unsupported
file.type.unsupported
Error message
file.type.unsupported
What it means
BusinessException 'file.type.unsupported' from TaskNcxImportServiceImpl.uploadFile when the supplied ConfigFileTypeEnum is not one of NCX, DBP, or JSON. The dispatch chain exhausts without matching and throws.
Source
Thrown at chat2db-community-server/chat2db-community-domain/chat2db-community-domain-core/src/main/java/ai/chat2db/community/domain/core/impl/ncx/TaskNcxImportServiceImpl.java:297
insertDatasource(dataSourceResponse);
});
}
return uploadResponse;
}
@Override
public NcxImportResponse uploadFile(File file, ConfigFileTypeEnum fileType) {
if (ConfigFileTypeEnum.NCX == fileType) {
return ncxUploadFile(file);
}
if (ConfigFileTypeEnum.DBP == fileType) {
return dbpUploadFile(file);
}
if (ConfigFileTypeEnum.JSON == fileType) {
return chat2dbUploadFile(file);
}
throw new BusinessException("file.type.unsupported");
}
@SneakyThrows
public int insertDBConfig(List<Map<String, Map<String, String>>> list) {
int n = 0;
for (Map<String, Map<String, String>> map : list) {
for (Map.Entry<String, Map<String, String>> valueMap : map.entrySet()) {
Map<String, String> resultMap = valueMap.getValue();
DataBaseTypeEnum dataBaseType = DataBaseTypeEnum.matchType(resultMap.get("ConnType"));
WorkspaceDataSource dataSourceDO;
if (null == dataBaseType) {
continue;
} else {
dataSourceDO = new WorkspaceDataSource();
dataSourceDO.setHost(resultMap.get("Host"));
dataSourceDO.setPort(resultMap.get("Port"));
dataSourceDO.setUrl(String.format(dataBaseType.getUrlString(), dataSourceDO.getHost(), dataSourceDO.getPort()));View on GitHub (pinned to 5ee1e990e7)
Solutions
- Send one of the supported file types: NCX, DBP, or JSON.
- If a new type is required, add a matching branch (e.g. chat2dbUploadFile/ncxUploadFile) before the fall-through throw.
- Validate the fileType against the supported set on the controller before calling uploadFile.
Example fix
// before
Set<ConfigFileTypeEnum> ok = EnumSet.of(NCX, DBP, JSON);
if (!ok.contains(fileType)) throw new BusinessException("file.type.unsupported");
// after (extend support)
if (ConfigFileTypeEnum.SQL == fileType) return sqlUploadFile(file);
Defensive patterns
Strategy: validation
Validate before calling
java.util.Set<ConfigFileTypeEnum> ok = java.util.EnumSet.of(ConfigFileTypeEnum.NCX, ConfigFileTypeEnum.DBP, ConfigFileTypeEnum.JSON);
if (fileType == null || !ok.contains(fileType)) throw new BusinessException("file.type.unsupported"); Type guard
boolean isSupportedUploadType(ConfigFileTypeEnum t) {
return t == ConfigFileTypeEnum.NCX || t == ConfigFileTypeEnum.DBP || t == ConfigFileTypeEnum.JSON;
} Prevention
- Whitelist fileType at the controller boundary.
- When adding a new ConfigFileTypeEnum, add its upload branch in the same change.
- Default the client selector to a supported type.
When it happens
Trigger: Calling uploadFile with a ConfigFileTypeEnum value other than NCX/DBP/JSON (e.g. an enum constant added later or SQL/CSV passed by mistake), or a null fileType.
Common situations: Client sends the wrong file-type discriminator for a config import; new enum added without an upload branch; integrator passes a default enum value.
Related errors
- The baseURL is not valid!
- The baseURL is not valid!
- Unsupported provider:
- exportType
- Error opening file '
AI-assisted analysis of OtterMind/Chat2DB@5ee1e990e7 (2026-08-14).
Data as JSON: /api/errors/61227259953e4176.
Report an issue: GitHub.