{"record":{"id":"4903b1195ea4e4c0","repo":"OtterMind/Chat2DB","slug":"file-not-exist","errorCode":null,"errorMessage":"file not exist","messagePattern":"file not exist","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"chat2db-community-server/chat2db-community-domain/chat2db-community-domain-core/src/main/java/ai/chat2db/community/domain/core/impl/excel/DbExcelTableServiceImpl.java","lineNumber":149,"sourceCode":"        try {\n            excelReader = EasyExcel.read(filePath).readDefaultReturn(ReadDefaultReturnEnum.ACTUAL_DATA).headRowNumber(0)\n                    .registerReadListener(new ReadMetaListener(result, filePath, this)).build();\n            List<ReadSheet> sheets = excelReader.excelExecutor().sheetList();\n            excelReader.read(sheets);\n        } catch (Exception e) {\n            throw new RuntimeException(e);\n        } finally {\n            if (excelReader != null) {\n                excelReader.close();\n            }\n        }\n    }\n\n\n    private Connection createExcelConnection(Long id, boolean create) {\n        String filePath = String.format(FILE_PATH, id);\n        if (!create && FileUtil.isEmpty(new File(filePath + \".mv.db\"))) {\n            throw new RuntimeException(\"file not exist\");\n        }\n        String jdbcUrl = \"jdbc:h2:\" + filePath;\n        Connection connection = null;\n        try {\n            Class.forName(\"org.h2.Driver\");\n            connection = DriverManager.getConnection(jdbcUrl, null, null);\n        } catch (Exception e) {\n            throw new RuntimeException(e);\n        }\n        return connection;\n    }\n\n    private void analyzeExcelWithRole(String filePath, ExcelCheckResponse result, Connection connection) {\n        ExcelReader excelReader = null;\n        try {\n            Map<Integer, ExcelCheckResponse.Sheet> sheetMap = result.getSheetList().stream().collect(Collectors.toMap(ExcelCheckResponse.Sheet::getSheetNo, s -> s));\n            excelReader = EasyExcel.read(filePath).readDefaultReturn(ReadDefaultReturnEnum.ACTUAL_DATA)\n                    .registerReadListener(new ReadHeaderListener(result, filePath, connection, this)).build();","sourceCodeStart":131,"sourceCodeEnd":167,"githubUrl":"https://github.com/OtterMind/Chat2DB/blob/5ee1e990e73fbcae1969dc554be254fedb3ab888/chat2db-community-server/chat2db-community-domain/chat2db-community-domain-core/src/main/java/ai/chat2db/community/domain/core/impl/excel/DbExcelTableServiceImpl.java#L131-L167","documentation":"RuntimeException 'file not exist' from createExcelConnection when opening an existing excel-import H2 store: it checks for '<filePath>.mv.db' and, with create=false, throws if that file is empty/missing.","triggerScenarios":"A subsequent excel-import step requests the H2 connection for an import id whose on-disk mv.db file was deleted, never created, or is zero-length (FileUtil.isEmpty).","commonSituations":"Temp directory cleaned between import phases; previous import failed before the file was created; the FILE_PATH base directory is not writable so creation silently produced nothing; stale id reused after cleanup.","solutions":["Verify the H2 file path pattern (FILE_PATH) resolves to a writable, existing directory and the .mv.db for the id is present.","Re-run the excel import from the upload/analyze step so the store is recreated with create=true first.","Ensure no external cleanup (cron, docker tmpfs) removes the import work directory mid-flow."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"java.io.File mv = new java.io.File(String.format(FILE_PATH, id) + \".mv.db\");\nif (!create && (!mv.exists() || mv.length() == 0)) throw new IllegalStateException(\"file not exist\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run the analyze/create phase before reopening an excel import store.","Use a persistent, writable directory for FILE_PATH.","Guard against external cleanup of the import work directory."],"tags":["excel","h2","filesystem","import"],"backgroundTag":null,"analyzedSha":"5ee1e990e73fbcae1969dc554be254fedb3ab888","analyzedAt":"2026-08-14T07:05:03.077Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}