{"record":{"id":"b48ff7423df2157c","repo":"apache/dolphinscheduler","slug":"sql-file-not-found","errorCode":null,"errorMessage":"sql file not found ","messagePattern":"sql file not found ","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"dolphinscheduler-tools/src/main/java/org/apache/dolphinscheduler/tools/datasource/upgrader/UpgradeDao.java","lineNumber":119,"sourceCode":"                String upgradeSQL;\n                if (databaseDialect.tableExists(T_VERSION_NAME)) {\n                    // Change version in the version table to the new version\n                    upgradeSQL = String.format(\"update %s set version = ?\", T_VERSION_NAME);\n                } else if (databaseDialect.tableExists(T_NEW_VERSION_NAME)) {\n                    // Change version in the version table to the new version\n                    upgradeSQL = String.format(\"update %s set version = ?\", T_NEW_VERSION_NAME);\n                } else {\n                    throw new RuntimeException(\"The version table does not exist\");\n                }\n                try (PreparedStatement pstmt = connection.prepareStatement(upgradeSQL)) {\n                    pstmt.setString(1, schemaVersion);\n                    pstmt.executeUpdate();\n                }\n            }\n            log.info(\"Success execute the dml file, schemaDir:  {}, ddlScript: {}\", schemaDir, scriptFile);\n        } catch (FileNotFoundException e) {\n            log.error(\"Cannot find the DDL file, schemaDir:  {}, ddlScript: {}\", schemaDir, scriptFile, e);\n            throw new RuntimeException(\"sql file not found \", e);\n        } catch (Exception e) {\n            log.error(\"Execute ddl file failed, meet an unknown exception, schemaDir:  {}, ddlScript: {}\", schemaDir,\n                    scriptFile, e);\n            throw new RuntimeException(\"Execute ddl file failed, meet an unknown exception\", e);\n        }\n    }\n\n    /**\n     * upgradeDolphinScheduler DDL\n     *\n     * @param schemaDir schemaDir\n     */\n    public void upgradeDolphinSchedulerDDL(String schemaDir, String scriptFile) {\n        String sqlFilePath =\n                String.format(\"sql/upgrade/%s/%s/%s\", schemaDir, dbType.getDb(), scriptFile);\n        SqlScriptRunner sqlScriptRunner = new SqlScriptRunner(dataSource, sqlFilePath);\n        try {\n            // Execute the dolphinscheduler ddl.sql for the upgrade","sourceCodeStart":101,"sourceCodeEnd":137,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-tools/src/main/java/org/apache/dolphinscheduler/tools/datasource/upgrader/UpgradeDao.java#L101-L137","documentation":"In UpgradeDao.upgradeDolphinSchedulerDML, if the DML script file (e.g. dolphinscheduler_dml.sql in the schema upgrade directory) cannot be found, the FileNotFoundException is rethrown as RuntimeException 'sql file not found '. Note the log message incorrectly says 'DDL file' even though this is the DML path.","triggerScenarios":"Calling upgradeDolphinSchedulerDML with a schemaDir that does not contain the expected DML sql file — wrong schema directory name in schemaList, missing packaged sql resources, or a typo'd scriptFile path.","commonSituations":"Incomplete deployment jar missing dolphinscheduler_dml.sql; upgrading from a version whose schema directory was removed or renamed; running the tool from a working directory lacking the sql resources on the classpath.","solutions":["Check the log line 'Cannot find the DDL file...' for the exact schemaDir and scriptFile path, and confirm the file exists there.","Reinstall/repair the DolphinScheduler tools distribution so all sql upgrade directories are present.","Verify schemaList matches the directories actually shipped under dolphinscheduler-datasource-api resources (dolphinscheduler_dml.sql present).","Run the tool from the installed distribution root so relative sql paths resolve."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// before upgrading, confirm the DML resource exists for the target version dir\nString path = \"dolphinscheduler-datasource-.../\" + schemaDir + \"/dolphinscheduler_dml.sql\";\nif (getClass().getClassLoader().getResource(path) == null) {\n    throw new IllegalStateException(\"Missing DML upgrade script: \" + path);\n}","typeGuard":null,"tryCatchPattern":"try {\n    manager.upgradeDolphinScheduler();\n} catch (RuntimeException e) {\n    if (e.getMessage().contains(\"sql file not found\")) {\n        log.error(\"Upgrade script missing - check schemaDir contents and reinstall the distribution\", e);\n    } else throw e;\n}","preventionTips":["Install the full official distribution; never strip sql/ resources.","Verify each schema directory contains both ddl and dml files before upgrading.","Run the tool from the distribution root directory.","Match the tool version to the installed DolphinScheduler version."],"tags":["database","upgrade","file"],"backgroundTag":"file-not-found","analyzedSha":"02eac45a1b6676e639fcbfb4be2243de5771b05d","analyzedAt":"2026-09-06T17:43:00.555Z","contentChangedAt":"2026-09-06T17:43:00.555Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}