{"record":{"id":"a683e6ad1c567be9","repo":"apache/shenyu","slug":"dynamic-result-getmessage-from-configsservice-configsexport","errorCode":null,"errorMessage":"dynamic: result.getMessage() from configsService.configsExport()","messagePattern":"dynamic: result\\.getMessage\\(\\) from configsService\\.configsExport\\(\\)","errorType":"exception","errorClass":"ShenyuException","httpStatus":null,"severity":"error","filePath":"shenyu-admin/src/main/java/org/apache/shenyu/admin/controller/ConfigsExportImportController.java","lineNumber":78,"sourceCode":"\n    public ConfigsExportImportController(final ConfigsService configsService,\n                                         final SyncDataService syncDataService) {\n        this.configsService = configsService;\n        this.syncDataService = syncDataService;\n    }\n\n    /**\n     * Export all configs.\n     *\n     * @param response response\n     * @return the shenyu result\n     */\n    @GetMapping(\"/export\")\n    @RequiresPermissions(\"system:manager:exportConfig\")\n    public ResponseEntity<byte[]> exportConfigs(final HttpServletResponse response) {\n        ShenyuAdminResult result = configsService.configsExport();\n        if (!Objects.equals(CommonErrorCode.SUCCESSFUL, result.getCode())) {\n            throw new ShenyuException(result.getMessage());\n        }\n        HttpHeaders headers = new HttpHeaders();\n        String fileName = generateFileName();\n        response.setHeader(\"Access-Control-Expose-Headers\", \"Content-Disposition\");\n        headers.add(\"Content-Disposition\", \"attachment;filename=\" + fileName);\n        return new ResponseEntity<>((byte[]) result.getData(), headers, HttpStatus.OK);\n    }\n\n    /**\n     * Export all configs.\n     *\n     * @param namespace namespaceId\n     * @param response response\n     * @return the shenyu result\n     */\n    @GetMapping(\"/exportByNamespace\")\n    @RequiresPermissions(\"system:manager:exportConfig\")\n    public ResponseEntity<byte[]> exportConfigsByNamespace(final String namespace, final HttpServletResponse response) {","sourceCodeStart":60,"sourceCodeEnd":96,"githubUrl":"https://github.com/apache/shenyu/blob/567142e07261b3e615ae8850b30f4421f455cc5d/shenyu-admin/src/main/java/org/apache/shenyu/admin/controller/ConfigsExportImportController.java#L60-L96","documentation":"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).","triggerScenarios":"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).","commonSituations":"Exporting config from an admin whose DB has corrupt/missing rows; running export during an inconsistent data state; insufficiently privileged or partially migrated databases.","solutions":["Read the dynamic message in the response/logs to identify the underlying service failure","Check admin logs at export time for the root MyBatis/DB exception and fix the underlying data issue","Retry the export after resolving; verify exported data via the dashboard"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// check admin health and DB connectivity before export\nif (!adminHealthOk() || !dbReachable()) { skipExport(); }","typeGuard":null,"tryCatchPattern":"try {\n    byte[] data = exportConfigs();\n} catch (ShenyuException e) {\n    log.error(\"config export failed: {}\", e.getMessage());\n    // inspect admin logs for the underlying service failure\n}","preventionTips":["Check admin logs immediately after a failed export — the dynamic message mirrors the service error","Ensure the export permission (system:manager:exportConfig) and DB state are healthy","Test exports after version upgrades before relying on them for backups"],"tags":["export","config","controller"],"backgroundTag":"api-error-response","analyzedSha":"567142e07261b3e615ae8850b30f4421f455cc5d","analyzedAt":"2026-09-12T10:08:21.293Z","contentChangedAt":"2026-09-12T10:08:21.293Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}