{"record":{"id":"cc9681694ed08e2d","repo":"apache/seatunnel","slug":"json-parsing-exception","errorCode":null,"errorMessage":"Json parsing exception.","messagePattern":"Json parsing exception\\.","errorType":"validation","errorClass":"java.lang.IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"seatunnel-api/src/main/java/org/apache/seatunnel/api/configuration/ReadonlyConfig.java","lineNumber":61,"sourceCode":"    /** Stores the concrete key/value pairs of this configuration object. */\n    protected final Map<String, Object> confData;\n\n    private ReadonlyConfig(Map<String, Object> confData) {\n        this.confData = confData;\n    }\n\n    public static ReadonlyConfig fromMap(Map<String, Object> map) {\n        return new ReadonlyConfig(map);\n    }\n\n    public static ReadonlyConfig fromConfig(Config config) {\n        try {\n            return fromMap(\n                    JACKSON_MAPPER.readValue(\n                            config.root().render(ConfigRenderOptions.concise()),\n                            new TypeReference<Map<String, Object>>() {}));\n        } catch (JsonProcessingException e) {\n            throw new IllegalArgumentException(\"Json parsing exception.\", e);\n        }\n    }\n\n    public <T> T get(Option<T> option) {\n        return getOptional(option).orElseGet(option::defaultValue);\n    }\n\n    /**\n     * Transform to Config todo: This method should be removed after we remove Config\n     *\n     * @return Config\n     * @deprecated Please use ReadonlyConfig directly\n     */\n    @Deprecated\n    public Config toConfig() {\n        return ConfigFactory.parseMap(confData);\n    }\n","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-api/src/main/java/org/apache/seatunnel/api/configuration/ReadonlyConfig.java#L43-L79","documentation":"ExcelReadStrategy.readByPoi opens a POI Workbook based on the current file's extension: .xls becomes HSSFWorkbook and .xlsx becomes XSSFWorkbook. Any other extension falls into the else branch and throws FileConnectorException with UNSUPPORTED_OPERATION, because the POI code path only knows how to read real Excel files.","triggerScenarios":"readByPoi (invoked from readProcess) is reached while currentFileName does not end with .xls or .xlsx — e.g. the discovery layer matched the file into an Excel source read but the file has a different or missing extension.","commonSituations":"Pointing a file source with format=excel at a .csv, .et, .xlsb, or extensionless file; files renamed without proper extension; a directory listing that mixes formats; uppercase or mixed-case extensions if the check is case-sensitive on the platform.","solutions":["Ensure every file matched by the source path has an .xls or .xlsx extension.","Use the correct file_format for non-Excel files (e.g. text/csv connectors) instead of forcing them through the Excel reader.","Rename the file to include a proper .xls/.xlsx extension if it is genuinely an Excel file."],"exampleFix":"// before\npath = \"/data/export\"   // contains export.csv, read with format=excel\n// after\npath = \"/data/export/report.xlsx\"   // point at actual .xlsx files","handlingStrategy":"validation","validationCode":"java\nString name = new File(path).getName().toLowerCase();\nif (!name.endsWith(\".xls\") && !name.endsWith(\".xlsx\")) {\n    throw new IllegalArgumentException(\"Excel reader requires .xls/.xlsx, got: \" + name);\n}","typeGuard":"java\nstatic boolean isExcelFile(String path) {\n    String n = path == null ? \"\" : path.toLowerCase();\n    return n.endsWith(\".xls\") || n.endsWith(\".xlsx\");\n}","tryCatchPattern":"java\ntry {\n    reader.readProcess(split);\n} catch (FileConnectorException e) {\n    if (e.getMessage().contains(\"Only support read excel file\")) {\n        LOG.error(\"Path matched non-Excel file; fix path or file_format\", e);\n    }\n}","preventionTips":["Point the source at specific .xlsx/.xls files, not mixed-format directories","Keep file extensions accurate when renaming or exporting files","Use format-specific connectors for csv/parquet/text files"],"tags":["excel","file-format","poi","connector-file"],"backgroundTag":"unsupported-operation","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}