iflytek/astron-agent · error · BusinessException

INTERNAL_SERVER_ERROR

INTERNAL_SERVER_ERROR

Error message

INTERNAL_SERVER_ERROR

What it means

deleteArtifact throws INTERNAL_SERVER_ERROR when the soft-delete update (setting deleted=TRUE on the WorkflowArtifact row) reports failure via MyBatis-Plus updateById returning false. This is an unexpected persistence failure after the artifact passed scope and writability checks; the object purge is deliberately deferred via TransactionSynchronization so the object store is only cleaned after a successful commit.

Solutions

  1. Retry the delete; verify the artifact still exists via the list endpoint first
  2. Check DB connectivity, lock waits, and connection-pool health in the toolkit service logs
  3. If using optimistic locking (@Version), refetch the entity before deleting to avoid stale-version updates
  4. Add idempotency: treat 'already deleted' as success by re-querying with deleted=TRUE included

Example fix

// before
if (!updateById(artifact)) {
    throw new BusinessException(ResponseEnum.INTERNAL_SERVER_ERROR);
}
// after
artifact = getScopedArtifactIncludingDeleted(artifactId);
if (Boolean.TRUE.equals(artifact.getDeleted())) {
    return; // idempotent no-op
}
if (!updateById(artifact)) {
    throw new BusinessException(ResponseEnum.INTERNAL_SERVER_ERROR);
}
Defensive patterns

Strategy: try-catch

Validate before calling

// Verify the artifact exists and is undeleted before deleting
WorkflowArtifact a = artifactApi.get(artifactId);
if (a == null || Boolean.TRUE.equals(a.getDeleted()))
    throw new IllegalStateException("Artifact already deleted: " + artifactId);

Try / catch

try {
    artifactApi.delete(artifactId);
} catch (BusinessException e) {
    if ("INTERNAL_SERVER_ERROR".equals(e.getCode())) {
        log.warn("Soft-delete failed for {}; retrying once", artifactId, e);
        artifactApi.delete(artifactId); // idempotent retry
    } else throw e;
}

Prevention

When it happens

Trigger: The artifact row no longer matches the update (e.g. concurrently deleted by another request between getScopedArtifact and updateById), a DB connectivity/lock-timeout failure surfaces as a 0-row update, or an optimistic-lock/version mismatch on the entity.

Common situations: Double-clicking delete so two requests race; database failover or connection-pool exhaustion mid-request; row deleted in another tab while this request was in flight.

Related errors


AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12). Data as JSON: /api/errors/d039c136edd239da. Report an issue: GitHub.

Appendix: source

Thrown at console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/workflow/WorkflowArtifactService.java:265

                .map(artifact -> toDto(artifact, false))
                .toList();
    }

    public WorkflowArtifactDto getDownloadInfo(Long artifactId) {
        WorkflowArtifact artifact = getScopedArtifact(artifactId);
        assertWorkflowVisible(artifact.getWorkflowId());
        return toDto(artifact, true);
    }

    @Transactional
    public void deleteArtifact(Long artifactId) {
        WorkflowArtifact artifact = getScopedArtifact(artifactId);
        assertWorkflowWritable(artifact.getWorkflowId());
        requireArtifactObjectLocation(artifact);
        artifact.setDeleted(Boolean.TRUE);
        artifact.setUpdateTime(LocalDateTime.now());
        if (!updateById(artifact)) {
            throw new BusinessException(ResponseEnum.INTERNAL_SERVER_ERROR);
        }
        Runnable purge = () -> purgeDeletedArtifactObject(artifact);
        if (TransactionSynchronizationManager.isSynchronizationActive()) {
            TransactionSynchronizationManager.registerSynchronization(
                    new TransactionSynchronization() {
                        @Override
                        public void afterCommit() {
                            purge.run();
                        }
                    });
        } else {
            purge.run();
        }
    }

    @Transactional
    public WorkflowArtifactDto uploadInternal(
            String token,

View on GitHub (pinned to 5e758547a8)