alibaba/spring-ai-alibaba · error · RuntimeException

查询评估器关联的实验失败:

Error message

查询评估器关联的实验失败: 

What it means

Catch-all in ExperimentServiceImpl.getExperimentsByEvaluator: any exception while querying experiments associated with an evaluator is logged and rethrown as a RuntimeException with the message '查询评估器关联的实验失败: ' plus the original cause message.

Source

Thrown at spring-ai-alibaba-admin/spring-ai-alibaba-admin-server-start/src/main/java/com/alibaba/cloud/ai/studio/admin/service/impl/ExperimentServiceImpl.java:660

                            return Experiment.fromDO(experimentDO);
                        } catch (Exception e) {
                            log.warn("获取数据集版本信息失败: experimentId={}, datasetVersionId={}", 
                                experimentDO.getId(), experimentDO.getDatasetVersionId(), e);
                            return Experiment.fromDO(experimentDO);
                        }
                    })
                    .toList();
            
            return new PageResult<>(
                    (long) totalCount,
                    (long) request.getPageNumber(),
                    (long) request.getPageSize(),
                    experiments
            );
            
        } catch (Exception e) {
            log.error("查询评估器关联的实验失败: {}", request, e);
            throw new RuntimeException("查询评估器关联的实验失败: " + e.getMessage());
        }
    }

} 

View on GitHub (pinned to f82da0b50f)

Solutions

  1. Inspect the logged underlying exception (stack trace in server logs) for the real cause
  2. Verify database connectivity and that the experiment/evaluator mapping tables exist
  3. Validate the request's pageNum/pageSize values before querying
  4. Catch the RuntimeException in the controller and map it to a 500 with the cause id

Example fix

// before
} catch (Exception e) {
    throw new RuntimeException("查询评估器关联的实验失败: " + e.getMessage());
}
// after
} catch (DataAccessException e) {
    log.error("查询评估器关联的实验失败: {}", request, e);
    throw new StudioException(StudioException.INTERNAL_ERROR, "查询评估器关联的实验失败");
}
Defensive patterns

Strategy: try-catch

Validate before calling

if (request.getPageNum() == null || request.getPageNum() < 1 || request.getPageSize() == null || request.getPageSize() < 1) { throw new IllegalArgumentException("invalid paging"); }

Type guard

null

Try / catch

try { service.getExperimentsByEvaluator(request); } catch (RuntimeException e) { log.error("evaluator experiment query failed", e); return ResponseEntity.internalServerError().body("query failed: check server logs"); }

Prevention

When it happens

Trigger: Any database error during the evaluator-experiment page query (table missing, bad SQL, connection failure) or an unexpected runtime error (e.g. NPE) inside the try block.

Common situations: Database down or unreachable from the admin server; schema drift after upgrade; malformed page request (pageSize/pageNum out of expected range) causing query failure.

Understand the failure class

Background: Database query failed: Internal Server Error 500s wrapping SQL, Prisma, and connection failures — what to check first — this error's family across 16 libraries.

Related errors


AI-assisted analysis of alibaba/spring-ai-alibaba@f82da0b50f (2026-09-09). Data as JSON: /api/errors/e6db1c9bb99ffd07. Report an issue: GitHub.