{"record":{"id":"c563d8a87b8b39ca","repo":"kestra-io/kestra","slug":"migration-script-scriptid-has-no-checksum-to-r","errorCode":null,"errorMessage":"Migration script [<scriptId>] has no checksum to repair.","messagePattern":"Migration script \\[<scriptId>\\] has no checksum to repair\\.","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/io/kestra/core/migration/MigrationRunner.java","lineNumber":147,"sourceCode":"     * @throws MigrationLockedException if another process holds the migration lock\n     * @throws Exception if the script is unknown, unapplied, unsupported, or the backend update fails\n     */\n    @Override\n    public void repairChecksum(final String scriptId) throws MigrationLockedException, Exception {\n        if (!lock.tryAcquire()) {\n            throw new MigrationLockedException();\n        }\n\n        try {\n            historyStore.bootstrapIfNeeded();\n\n            MigrationScript script = scripts.stream()\n                .filter(candidate -> candidate.scriptId().equals(scriptId))\n                .findFirst()\n                .orElseThrow(() -> new IllegalArgumentException(\"Unknown migration script [\" + scriptId + \"].\"));\n\n            if (script.checksum() == null) {\n                throw new IllegalArgumentException(\"Migration script [\" + scriptId + \"] has no checksum to repair.\");\n            }\n\n            if (!historyStore.isApplied(scriptId)) {\n                throw new IllegalStateException(\"Cannot repair migration script [\" + scriptId + \"] because it has not been applied.\");\n            }\n\n            historyStore.updateChecksum(script);\n            log.info(\"Migration checksum repaired for script [{}].\", scriptId);\n        } finally {\n            lock.release();\n        }\n    }\n\n    /**\n     * Returns all scripts that have not yet been applied, sorted by {@code scriptId}.\n     * Used by EE to detect pending scripts before deciding whether to run or fail.\n     *\n     * <p>","sourceCodeStart":129,"sourceCodeEnd":165,"githubUrl":"https://github.com/kestra-io/kestra/blob/823fada9274c4f9c251ea0a516460a4f7d958032/core/src/main/java/io/kestra/core/migration/MigrationRunner.java#L129-L165","documentation":"Thrown by repairChecksum() when the resolved MigrationScript for the given scriptId has a null checksum. The repair operation's entire purpose is to overwrite the stored checksum with the script's current checksum, so a null checksum makes the operation meaningless and is rejected. This is an IllegalArgumentException indicating caller error — the script cannot be repaired.","triggerScenarios":"Passing a scriptId whose MigrationScript.checksum() returns null (e.g., a script type that does not compute a checksum, or a dynamically-generated script); referencing a script ID that resolves but legitimately has no checksum.","commonSituations":"Operator targets the wrong script for repair; a custom or experimental migration script was registered without a checksum; confusion between script types where only some carry checksums.","solutions":["Confirm the scriptId actually has a checksum by inspecting the MigrationScript bean.","If the script genuinely has no checksum, repair is not applicable — do not call it.","Re-run 'kestra migrate' normally; a missing checksum usually means the script is handled differently by the runner.","List available scripts to verify you targeted the correct ID."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"MigrationScript script = scripts.stream()\n    .filter(s -> s.scriptId().equals(scriptId))\n    .findFirst().orElse(null);\nif (script == null || script.checksum() == null) {\n    log.warn(\"Script {} has no checksum; repair is not applicable.\", scriptId);\n    return;\n}","typeGuard":null,"tryCatchPattern":"try {\n    migrationRunner.repairChecksum(scriptId);\n} catch (IllegalArgumentException e) {\n    log.warn(\"Repair not applicable for script {}: {}\", scriptId, e.getMessage());\n}","preventionTips":["Inspect the MigrationScript.checksum() before invoking repair.","Do not assume all script types carry checksums."],"tags":["migration","validation","checksum","repair"],"backgroundTag":null,"analyzedSha":"823fada9274c4f9c251ea0a516460a4f7d958032","analyzedAt":"2026-08-14T06:15:17.947Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}