OtterMind/Chat2DB · warning · ParamBusinessException
common.paramDetailError
common.paramDetailError
Error message
common.paramDetailError
What it means
ParamBusinessException ('common.paramDetailError') from ExportFactory.getExporter when the requested export type (lowercased) is not one of xls, xlsx, csv, json, sql — no IExportStrategy is registered for it.
Source
Thrown at chat2db-community-server/chat2db-community-domain/chat2db-community-domain-core/src/main/java/ai/chat2db/community/domain/core/impl/task/export/ExportFactory.java:25
import ai.chat2db.community.domain.core.impl.task.export.json.JsonDataExporter;
import ai.chat2db.community.domain.core.impl.task.export.sql.SqlDataExporter;
import java.util.Map;
import java.util.Objects;
public class ExportFactory {
private static final Map<String, IExportStrategy> exports = Map.of(
"xls", new XlsDataExporter(),
"xlsx", new XlsxDataExporter(),
"csv", new CsvDataExporter(),
"json", new JsonDataExporter(),
"sql", new SqlDataExporter()
);
public static IExportStrategy getExporter(String type) {
IExportStrategy dataExportStrategy = exports.get(type.toLowerCase());
if (Objects.isNull(dataExportStrategy)) {
throw new ParamBusinessException(type);
}
return dataExportStrategy;
}
}
View on GitHub (pinned to 5ee1e990e7)
Solutions
- Use one of the supported types: xls, xlsx, csv, json, sql.
- If a new format is needed, implement IExportStrategy and add it to the exports map in ExportFactory.
- Validate the type client-side against the supported set before submitting.
Example fix
// before
IExportStrategy s = ExportFactory.getExporter("xml"); // throws
// after
IExportStrategy s = ExportFactory.getExporter("csv");
Defensive patterns
Strategy: type-guard
Validate before calling
java.util.Set<String> supported = java.util.Set.of("xls","xlsx","csv","json","sql");
if (type == null || !supported.contains(type.toLowerCase())) throw new ParamBusinessException(type); Type guard
boolean isSupportedExportType(String t) {
return t != null && java.util.Set.of("xls","xlsx","csv","json","sql").contains(t.toLowerCase());
} Prevention
- Constrain the format selector client-side to the registered set.
- Register any new format strategy in ExportFactory before exposing it.
- Normalize and lowercase the type before lookup.
When it happens
Trigger: Calling getExporter with an unsupported/typo'd type string (e.g. 'xl', 'xml', 'tsv', null after toLowerCase via NPE, or an empty string).
Common situations: Frontend sends a format the backend doesn't ship; typo in the format selector; new format requested without registering a strategy.
Related errors
AI-assisted analysis of OtterMind/Chat2DB@5ee1e990e7 (2026-08-14).
Data as JSON: /api/errors/2935f30e380dcd3f.
Report an issue: GitHub.