flowable/flowable-engine · error · FlowableException

Error reading batch part

Error message

Error reading batch part 

What it means

FlowableException thrown by GetCaseInstanceMigrationBatchResultCmd.convertFromBatchPart when the batch part's JSON result cannot be parsed (JacksonException). The stored batch-part result document is malformed or unreadable, so the engine cannot reconstruct the per-instance migration result.

Solutions

  1. Inspect the offending batch part record's RESULT_ content and repair or delete the corrupted row
  2. Re-run the case migration batch so fresh, valid batch parts are written
  3. Confirm the engine version reading the batch matches the one that wrote it; upgrade both together

Example fix

// before
BatchPartResult partResult = migrationService
    .createCaseMigrationBatchResult(batchId).getBatchPartResult(batchPartId);
// after
try {
    partResult = migrationService.createCaseMigrationBatchResult(batchId)
        .getBatchPartResult(batchPartId);
} catch (FlowableException e) {
    // re-run migration or inspect raw batch part
}
Defensive patterns

Strategy: try-catch

Type guard

boolean looksLikeJson = batchPart != null && batchPart.getResult() != null && batchPart.getResult().startsWith("{");

Try / catch

try { partResult = batchResult.getBatchPartResult(batchPartId); } catch (FlowableException e) { log.error("corrupt batch part {}, re-run migration", batchPartId); }

Prevention

When it happens

Trigger: Reading a case migration batch result whose batch part documents were written by an incompatible engine version or corrupted in storage; batch part contains non-JSON content where a result node was expected.

Common situations: Upgrading Flowable across versions where the batch result serialization changed; database rows edited/migrated manually; partial writes from a failed upgrade; copying batch tables between environments with schema drift.

Understand the failure class

Background: JSON parse error: "Unexpected token" / "not valid JSON" / "failed to parse" — what JSON parsers are really complaining about — this error's family across 45 libraries.

Related errors


AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11). Data as JSON: /api/errors/7449428e1a57ab7f. Report an issue: GitHub.

Appendix: source

Thrown at modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/GetCaseInstanceMigrationBatchResultCmd.java:109

        partResult.setResult(batchPart.getStatus());
        if (CaseInstanceBatchMigrationResult.RESULT_FAIL.equals(batchPart.getStatus()) &&
                batchPart.getResultDocumentJson(engineConfiguration.getEngineCfgKey()) != null) {

            try {
                JsonNode resultNode = objectMapper.readTree(batchPart.getResultDocumentJson(engineConfiguration.getEngineCfgKey()));
                if (resultNode.has(BATCH_RESULT_MESSAGE_LABEL)) {
                    String resultMessage = resultNode.get(BATCH_RESULT_MESSAGE_LABEL).asString();
                    partResult.setMigrationMessage(resultMessage);
                }
                
                if (resultNode.has(BATCH_RESULT_STACKTRACE_LABEL)) {
                    String resultStacktrace = resultNode.get(BATCH_RESULT_STACKTRACE_LABEL).asString();
                    partResult.setMigrationStacktrace(resultStacktrace);
                }

            } catch (JacksonException e) {
                throw new FlowableException("Error reading batch part " + batchPart.getId());
            }
        }
        return partResult;
    }

}

View on GitHub (pinned to d6d39ce1c6)