apache/shenyu · error · ShenyuException

dynamic: result.getMessage() from…

Error message

dynamic: result.getMessage() from configsService.configsExport()

What it means

The /configs/export endpoint delegates to configsService.configsExport(); if the returned ShenyuAdminResult code is not SUCCESSFUL, the controller rethrows the service's message as a ShenyuException. The message is dynamic — whatever the export service failed with (e.g. data assembly or DB failure during export).

Solutions

  1. Read the dynamic message in the response/logs to identify the underlying service failure
  2. Check admin logs at export time for the root MyBatis/DB exception and fix the underlying data issue
  3. Retry the export after resolving; verify exported data via the dashboard
Defensive patterns

Strategy: try-catch

Validate before calling

// check admin health and DB connectivity before export
if (!adminHealthOk() || !dbReachable()) { skipExport(); }

Try / catch

try {
    byte[] data = exportConfigs();
} catch (ShenyuException e) {
    log.error("config export failed: {}", e.getMessage());
    // inspect admin logs for the underlying service failure
}

Prevention

When it happens

Trigger: Calling GET /configs/export with 'system:manager:exportConfig' permission while configsService.configsExport() returns a non-success code (export data assembly failed, e.g. DB errors or empty/invalid config snapshot).

Common situations: Exporting config from an admin whose DB has corrupt/missing rows; running export during an inconsistent data state; insufficiently privileged or partially migrated databases.

Related errors


AI-assisted analysis of apache/shenyu@567142e072 (2026-09-12). Data as JSON: /api/errors/a683e6ad1c567be9. Report an issue: GitHub.

Appendix: source

Thrown at shenyu-admin/src/main/java/org/apache/shenyu/admin/controller/ConfigsExportImportController.java:78

    public ConfigsExportImportController(final ConfigsService configsService,
                                         final SyncDataService syncDataService) {
        this.configsService = configsService;
        this.syncDataService = syncDataService;
    }

    /**
     * Export all configs.
     *
     * @param response response
     * @return the shenyu result
     */
    @GetMapping("/export")
    @RequiresPermissions("system:manager:exportConfig")
    public ResponseEntity<byte[]> exportConfigs(final HttpServletResponse response) {
        ShenyuAdminResult result = configsService.configsExport();
        if (!Objects.equals(CommonErrorCode.SUCCESSFUL, result.getCode())) {
            throw new ShenyuException(result.getMessage());
        }
        HttpHeaders headers = new HttpHeaders();
        String fileName = generateFileName();
        response.setHeader("Access-Control-Expose-Headers", "Content-Disposition");
        headers.add("Content-Disposition", "attachment;filename=" + fileName);
        return new ResponseEntity<>((byte[]) result.getData(), headers, HttpStatus.OK);
    }

    /**
     * Export all configs.
     *
     * @param namespace namespaceId
     * @param response response
     * @return the shenyu result
     */
    @GetMapping("/exportByNamespace")
    @RequiresPermissions("system:manager:exportConfig")
    public ResponseEntity<byte[]> exportConfigsByNamespace(final String namespace, final HttpServletResponse response) {

View on GitHub (pinned to 567142e072)